#ot1-perplexing-regexing
1 messages Β· Page 587 of 1
because wave functions 
Pls don't kill cats
it's just a metaphor
I have a pet cat
ah yes electrons are worth a cat 
Oh
I've got two
the double slit experiment, but you send the cat through instead
rather, it's in a superposition between alive and dead, and when you open the box you force it into one or the other by collapsing the wave function, and in doing do there is a calculable probability that it will collapse one way or the other
nah
Yeah that
or you don't collapse it at all, and decoherence kicks in and makes both events happen anyway in different "worlds"
thinking of superposition as being in two states at the same time is less than helpful
rather, superposition is a state in its own right, which collapses into a concrete state when observed
this is made most explicit in how measuring qubits in quantum computers works
Quantum stuff
i made a simple quantum entanglement program once and ran it on one of ibm's quantum computers
random.randint will work better on quantum computer I guess
ibm is a very cringe company
typical big tech corp stuff
anticompetitive practices
bad to their employees
yeah, IBM is very big no-no
example: there was a big scandal some months back where they practically fired a guy cuz he forgot to switch to his work email before committing something to the internal git repo cuz it was "unprofessional"
i don't have any idea, ask in a proper python help channel maybe?
"As an IBM employee, you are not allowed to use your gmail account to work in any way on VNIC. You are not allowed to use your personal email account as a "hobby". You are an IBM employee 100% of the time. Please remove yourself completely from the maintainers file. I grant you a 1 time exception on contributions to VNIC to make this change."
Do you perhaps mean this?
Because yeah, this super sucked lmao
yep
"You are an IBM employee 100% of the time" lol
what is this bs
they ordered him to remove all trace of him ever having committed a single line of code and then, it is assumed they fired him
late stage capitalism
corporate problems bad
you think >_>
hhhhhhh
when do you sleep π
yesterday
π
i mean, last time i slept was technically yesterday
yes
but u woke up today
no i woke up yesterday
bruh
i went to bed yesterday too
when I feel like it
fair
exactly 
I just noticed that you have a gun in your pfp
took me long enough to figure that out 
but do u ever feel sleepy
a bazooka*
grenade launcher
ah i see
or more accurate I don't see
prepare to be yoinked from reality
on occasion, yes
ur pfp seems like its eating something while yeeting people off the world.. interesting correlation with about
!otn a yoinked from reality
:ok_hand: Added yoinked-from-reality to the names list.

back at it again with a new ot name
yes yes, thank you
I'll be here for the next 3.4 seconds
How do off-topic names change?
ye
What's the list, and how are they picked?
I mean, how are the ones that you add to the list chosen?
randomly
why u do dis
my eyes
cauz i have this
are burning
ok
guess the next line after this
return
asyncio.sleep(86400)
lmao
lmao
ikr
MY EYEEEEEEEES
I have some good code for you in a sec
oki
thats a day
!src otn
Add or list items from the off-topic channel name rotation.
await sleep_until(next_midnight)
bruh
not like that
await bot.sleep_until(time delta)
and then you need to update time delta + 1 day
for it to work
so asyncio sleep is better anyway π
could have said 3.14 
nerd
that emote should be :openthefuckupimmaremoveurteeth:
no
but yes
:unshu
guys what are web hooks >:((
i have 0 words for this code... I have 0 words for this code... https://paste.pythondiscord.com/povubohugu.apache
wdym?
to be fair, mine's an entire game (although it's not working right now)
and mine would be that length, just... i don't know how to shorten if statements or classes or anything like that-
@rough sapphire :white_check_mark: Your eval job has completed with return code 0.
Utah bread
lmfao
are you serious-
classes can be one-lined with the type constructor
I don't know anything about constructors mate, I've been coding for 4 months π
class type(object)``````py
class type(name, bases, dict, **kwds)```
With one argument, return the type of an *object*. The return value is a type object and generally the same object as returned by [`object.__class__`](https://docs.python.org/3/library/stdtypes.html#instance.__class__ "instance.__class__").
The [`isinstance()`](https://docs.python.org/3/library/functions.html#isinstance "isinstance") built-in function is recommended for testing the type of an object, because it takes subclasses into account.
class A(BaseClass):
def __init__(self, a):
self.a = a
is equivalent to
A = type("A", (BaseClass,), {"__init__": lambda self, a: setattr(self, 'a', a)})
for example
yeah i always wondered how that works since u keep sending those weirdly made classes
my secrets have been revealed 
i never bothered to learn about lambda either lmaoooo
essentially a one line function with no name
ugh i probably should tho-
An anonymous inline function consisting of a single expression which is evaluated when the function is called. The syntax to create a lambda function is lambda [parameters]: expression
**kwds? kwargs? but what for?
well no i mean i did basic stuff, i just... don't know how to make one really? I can semi understand one
oh nvm
what in the world is a metaclass?
time to run help
nah kwargs wouldn't be for metaclasses
and spyder is dead slow
if a class is a blueprint for its objects, a metaclass is a blueprint for classes
how in the world-
noted
WHAT IS A PROTOCOL
whaaa
class typing.Protocol(Generic)```
Base class for protocol classes. Protocol classes are defined like this:
```py
class Proto(Protocol):
def meth(self) -> int:
...
``` Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing), for example...
What on earth is happening in here π
this... isn't okay
!e
class MyMeta(type):
def __add__(self, other):
return 5
class A(metaclass=MyMeta): pass
class B(metaclass=MyMeta): pass
print(A + B)
@acoustic moss :white_check_mark: Your eval job has completed with return code 0.
5
but either way u would included them in bases right?
ouuuuu sounds interesting.. but i still don't know about generators really or hell the only dunder method i know is __init__() so... yeah ;-;
He's adding the classes there, not the instances
yeah
what? π₯²
if a class B inherited from A, instances of B would follow the blueprint laid down by both A and B
if a class B has a metaclass A, instances of B are unaffected, but B itself follows the blueprint laid by A
hsp at this point u scaring lmao
metaclasses allow you to change the class itself, inheritence will allow you to inherit attributes, methods etc from another class that will be reflected in the class instances
sure
the __add__ dunder dictates how a + b would work when a is an instance of that class
!e
class MetaStuff:
def __init__(*letsjustignorethis):
print("Makin classes")
def __call__(cls):
print("Hello world")
class HelloWorld(metaclass=MetaStuff):
...
HelloWorld()
@tranquil orchid :white_check_mark: Your eval job has completed with return code 0.
001 | Makin classes
002 | Hello world
so basically metaclass tells how the class behaves and interacts with other classes or stuff?
black formatter*
yes
exactly
not necessarily with other classes
just how a class itself behaves
ohh
this... does indeed put a scary smile on my face... (learning is fun to me, so hearing i have more to learn is just heheheheh yes.) (at the same time tho it's scary ;-;)
interesting
classes are objects to, metaclasses are basically just classes... for your classes
ye
whoaaaa, that dunder is __radd__
if you do a + b and there is no __add__ defined for a, it'll call __radd__ of b
π€ are they?
oh fuck obv
wait what-
just how many dunders are there...
more than i can count
two lots, not just one
why cls arg in __call__ ?
i'm estimating at least 100
Because the class is passed to it
Think of it like self
class float(float):
def __invert__(self):
return f"it's about {round(self)}"
a = float(12.6234)
print(~a)
best dunder
there's 200+ modules in python... (and counting)
!e
class float(float):
def __invert__(self):
return f"it's about {round(self)}"
a = float(12.6234)
print(~a)
@tranquil orchid :white_check_mark: Your eval job has completed with return code 0.
it's about 13
I don't think so
!e ~1.1
@acoustic moss :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | TypeError: bad operand type for unary ~: 'float'
Only ints
hm
wait... print(~a)??? what's up with the grave-
its the bitwise not operator
flips all bits in an int
in this case he implemented it to do something else but wtv
!e
class int(int):
def __invert__(self):
return f"it's about {self}.1"
a = int("1")
print(~a)
:(
@dire siren :white_check_mark: Your eval job has completed with return code 0.
it's about 1.1
I guess I'll add a bitwise to my to learn list too ;-;
yay
heh, the bitwise operators aren't that important
they told me it did -(self+1) ._.
doesn't work π
@rough sapphire :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 4, in <module>
003 | TypeError: can't set attributes of built-in/extension type 'float'
ye
Can't hurt to look into it shrug
mmm
!e print(~1)
@spare lance :white_check_mark: Your eval job has completed with return code 0.
-2
just as i was starting to finish my to learn list it expands by 30 in one day :,>
!e print(~-2)
@spare lance :white_check_mark: Your eval job has completed with return code 0.
1
!e
print(chr(96)*3)
@dire siren :white_check_mark: Your eval job has completed with return code 0.
Code block escape attempt detected; will not output result
Full output: https://paste.pythondiscord.com/yuwibavaca.txt?noredirect
that's true, but 30 in one day is painful π₯²
but the thing never ends
!e print(chr(1))
@dire siren :white_check_mark: Your eval job has completed with return code 0.
@rough sapphire :warning: Your eval job has completed with return code 0.
[No output]
wow helpful, thanks
LMAO
i should be more specific... 26* but as i said, in one day? that's just... pain.
u+001 should be null iirc
@rough sapphire :white_check_mark: Your eval job has completed with return code 0.
Code block escape attempt detected; will not output result
Full output: https://paste.pythondiscord.com/xitetudobe.txt?noredirect
thank goodness I'm 15 and have tons of time muahahahahaha-
!e print("```breh")
@dire siren :warning: Your eval job has completed with return code 0.
[No output]
bruh
@rough sapphire :white_check_mark: Your eval job has completed with return code 0.
Code block escape attempt detected; will not output result
Full output: https://paste.pythondiscord.com/buqeluboco.txt?noredirect
ye
i really wonder why this gives no output
@dire siren :white_check_mark: Your eval job has completed with return code 0.
```
explain @royal lake
why are you doing this
!e
the_meaning_of_life = ""
try:
print(f"The meaning of life is: {the_meaning_of_life_}")
except:
print(f"Death to all creatures who don't know {the_meaning_of_life}")
@jovial kelp :white_check_mark: Your eval job has completed with return code 0.
Death to all creatures who don't know
WAIT WHAT
oh- I'm slow
!e
the_meaning_of_life = ""
try:
print(f"The meaning of life is: {the_meaning_of_life}")
except:
print(f"Death to all creatures who don't know {the_meaning_of_life}")
@jovial kelp :white_check_mark: Your eval job has completed with return code 0.
The meaning of life is:
there ya go, much better-
hey @royal lake evaluate the answer to life
@dire siren :white_check_mark: Your eval job has completed with return code 0.
The answer to life is 69
holy guacamole
@royal lake Question aph
@spare lance :white_check_mark: Your eval job has completed with return code 0.
is it tho <@β!611418694245154847>
python says it is so it is
python is answering to someone named <@β!611418694245154847> not aph
possible
I was actually thinking that somebody should create a tool that would translate code from one language into another ;-;
i'ma try
possible
i wont try
sounds extremely painful though
then again so is creating a language as a whole...
when did i say anything about a module? ;-;
you need to translate it
oh... oh that's a good point
!e e
@odd sluice :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name 'e' is not defined
cool
!e the meaning of life
@jovial kelp :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | the meaning of life
003 | ^
004 | SyntaxError: invalid syntax
damn
!e import this
@odd sluice :white_check_mark: Your eval job has completed with return code 0.
001 | The Zen of Python, by Tim Peters
002 |
003 | Beautiful is better than ugly.
004 | Explicit is better than implicit.
005 | Simple is better than complex.
006 | Complex is better than complicated.
007 | Flat is better than nested.
008 | Sparse is better than dense.
009 | Readability counts.
010 | Special cases aren't special enough to break the rules.
011 | Although practicality beats purity.
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/ijisutijav.txt?noredirect
VSC calling you out... π³ Editing lambda_assignment.py 13:50:37 elapsed
oh jeez that's a long time
@rough sapphire i'm getting some process, how to find how many , does a string have
current code:
import inspect
def lambda_to_def(func):
lines = inspect.getsource(func)
lines[lines.find("lambda ")+7:lines.find(":")]
string.count(",")?
ty, i forgot simple funcs
nvm i'm too stupid i don't even need it lol
what even
sounds like somebody should refresh on the data type methods :0
i have now fully commented my code for the first time, feels... odd.
@rough sapphire
test this
import inspect
def lambda_to_def(func,name):
lines = inspect.getsource(func)
code = f"def {name}("+lines[lines.find("lambda ")+7:lines.find(":")]+"):\n"
if lines[lines.find(":")+1:len(lines)-1][0] != " ":
code+="\treturn"+lines[lines.find(":")+1:len(lines)-1]
else:
code+=" return"+lines[lines.find(":")+1:len(lines)-1]
return code
it's not fully functional expect errors running it
you have to give a lambda func on func
tested, worked for me idk other funcs so uh
there's probably some weird lambda i cant fix
returned this:
def a_name(_):
return_+1
probably the \t made it weird
i'ma make it just 4 spaces
oh didn't work
i'ma add a space
new ver:
import inspect
def lambda_to_def(func,name):
lines = inspect.getsource(func)
code = f"def {name}("+lines[lines.find("lambda ")+7:lines.find(":")]+"):\n"
if lines[lines.find(":")+1:len(lines)-1][0] != " ":
code+=" return "+lines[lines.find(":")+1:len(lines)-1]
else:
code+=" return "+lines[lines.find(":")+1:len(lines)-1]
return code
should be working on MOST lambdas
idk
had fun playing with strings
works
the name parameter is to protect user from doing something like lambda _:_+1 without variable assignment
so uh
inspect.getsource? it gets u the code ?
i'ma make a list comp to for loop this is fun
gets source code from function
it'll die
!epy import inspect def xyz(): return "blabbers" print(inspect.getsource(xyz))
@rough sapphire use this version instead
def str_lambda_to_def(func,name):
code = f"def {name}("+func[func.find("lambda ")+7:func.find(":")]+"):\n"
if func[func.find(":")+1:len(func)-1][0] != " ":
code+=" return "+func[func.find(":")+1:len(func)-1]
else:
code+=" return "+func[func.find(":")+1:len(func)-1]
return code
!?
it didn't work?
h0w
!epy import inspect def xyz(): return "blabbers" print(inspect.getsource(xyz))
what the bot ded?
sad
!e print("hello")
@spare lance :white_check_mark: Your eval job has completed with return code 0.
hello
!e import os
print(os.listdir())
@dire siren :white_check_mark: Your eval job has completed with return code 0.
['Pipfile', 'Pipfile.lock', 'config', 'snekbox', 'user_base', 'tests', 'LICENSE']
@dire siren :white_check_mark: Your eval job has completed with return code 0.
001 | /snekbox
002 | {'tests', 'config', 'snekbox', 'user_base'}
use the string version
def str_lambda_to_def(func,name):
code = f"def {name}("+func[func.find("lambda ")+7:func.find(":")]+"):\n"
if code
if func[func.find(":")+1:len(func)-1][0] != " ":
code+=" return "+func[func.find(":")+1:len(func)]
else:
code+=" return "+func[func.find(":")+1:len(func)]
return code
``` wish for testers
probably won't work if lambda:
def str_lambda_to_def(func,name):
if func.find("lambda ") != -1:
code = f"def {name}("+func[func.find("lambda ")+7:func.find(":")]+"):\n"
else:
code = f"def {name}("+func[func.find("lambda")+7:func.find(":")]+"):\n"
if func[func.find(":")+1:len(func)-1][0] != " ":
code+=" return "+func[func.find(":")+1:len(func)]
else:
code+=" return "+func[func.find(":")+1:len(func)]
return code
improve
and it doesn't work lol
it'll probably work on a single lambda, you might want to run the function twice if there's more than one
@acoustic moss bro do u have the answer to that algo question u sent?
i have the answers yeah
there is no official code solution though
hmm wait i have a bad soln lemme just fair it out a bit
π regex moment
regex too hard
i'might do some weird replace to regex stuff later on
whomst hath pingedeth
plz give creduts
O
yay
for all valid reasons.. i am assuming i am wrong
very nice
no u can gimme any number and we can compare the answers
whats pie
principle of inclusion exclusion
oh
i ran into negatives in the first iteration so i left it
wow
i did too then i realised i was not sorting just 1 god damn case because i was using append ._.
make a list comp to for loop next
then dict comp,
then tuple comp (does this even exist lol)
lol
import itertools
def f(n, k):
c = 0
for i in itertools.product(range(k + 1), repeat=n):
if "0, 1, 0" not in ", ".join(i):
c += 1
return c
imma try doing it the correct way later
sigh yes this is a better way ._.
nah lol
i wanna lowkey time it
pypy might be slow in some case
btw is it possible to make a cython jit
liek pypy + cython
File "E:\Coding_stuff\Python\projects\random_stuff\aph_problem.py", line 74, in <module>
print(f(20,1))
File "E:\Coding_stuff\Python\projects\random_stuff\aph_problem.py", line 64, in f
if "0, 1, 0" not in ", ".join(i):
TypeError: sequence item 0: expected str instance, int found```
why did i name it aph problem tho.. should be hsp
uh yeah do .join(map(str, i))
ok
!e
print((lambda n,k: len([i for i in __import__('itertools').product(range(k+1),repeat = n) if '0,1,0' not in ','.join(map(str,i))]))(3,2))
@solemn leaf :white_check_mark: Your eval job has completed with return code 0.
26
π worst time complexity
that'll stop working for k >= 10 lol
.
.
ok
ok
ok
ok
ok
ok
no
ok
thats the neat part, i dont
@rough sapphire :white_check_mark: Your eval job has completed with return code 0.
Utah bread
Thats the opposite of golfing lol
yes exactly
which is technically harder if u forgot the way u golfed stuff like that
how the heck do u even pronounce it
._.
ob fus cation
ob-fus-kay-shun?
when i lie
yes
no he the old one was good >:((
good qn
no tom holland best die
wtf is ur name
who r u
and why do u have the same pfp as my friend
yee its pretty good.. and u can do it tho.. maybe easily too
because i am the friend?
use .catify
:?
.catify
Your catified nickname is: α£αα’ | α£αα’

just type ".catify"
.catify
Your catified nickname is: Astonator7 | π
why change name... catify good >:((
:sadge:
bc wtf are u saying ;-;
how is it a cat
;-;-;-;-;-;-;
oHHHHHHHHHHHHH
catify means
to cat urself
ZOOM IN
Don't call people that
bruh what is this kid
ban means u get kicked out
That isn't acceptable
i can say many things but i won't
oh my god scoff is here ||hide||
ngl you sound like you're 10
hey shush dont.. please maintain peace
rust vs modern c++?
well that doesn't sound like astonatorish

Hey please don't be an asshole
@rough sapphire Hi. Do you mind hearing my project that im working on?
sure
what are u working on
o
that sounds nice
is it open source
well i havent done much work on it yet im just learning opengl but ive made a thin sdl wrapper. https://github.com/Vaxeral/Gravel
oo
i see
you can actually represent a hexagonal map as a 3d cube map which is what im going to try and do to code it
nice
C++ i see
since a hexagon map kind of has 3 axis and so does 3d space
So cpp your main?
yes it was my first language. Im coming back to it after language hopping the biggest thing ive made in code is probably tetris in lua and love2d framework
Lua is nice
Dynamic and has performance
Rare to find
but not much libraries written for it compared to python but eh i dont use libraries very often.
Thats Lua's only disadvantage
i do like it though i find its simplicity very welcoming
But i wish i could learn Lua
however i doubt i would ever be doing that
I have been on the verge of quiting coding in pursuit of a career. As coding is really just a hobby for me. Ive struggeled to come up with game ideas which is why i got into coding to make games, but im just not very creative. Im giving my shot at creating board games in code and hopefully have as much fun as i did with tetris
that sucks, but good luck in whatever you persue!
thanks
have a nice night
Hm
well
its actualy a good thing if u enjoy not being creative and still programming
cuz
in jobs no one is going to let u be creative 
theres gonna be a prod manager
and he/she is going to tell u what to do
and u do it
dats about it
become the manager's manager ez
we have a joker here
do you know when to use a static assert and when to use a regualar assert? Isnt static assert for things that might fail at compile time and that are constant? or am i wrong
ah i seem to be right on this
just looked at learncpp.com
did you know you can scope variables to a file by declaring them in a unnamed namespace like so
namespace
{
int instance_count = 0;
}
fuck u
this author is mental
there are lots of people who hate py for no reason whatsoever
THIS is the reason why I'm saying this
quite nice stereotyping, isn't it?
did you really read that?
hmm, generalizing people who use certain langs
i wonder how many times he has been in a fist fight over python to write that π
Not unreasonable for it to be one, though. this is a keyword in many languages.
you mean this this?

it's just a parameter name 
albeit the only one which PEP8 allows
but still
that's not called a keyword
in c++ its a pointer to a object
you can f'ing use this if you wanted to
lmfao
hmm is this a keyword in c++
yeah
I could do this:
class OK:
def __init__(e):
...
The weird thing in Python is that it's just a parameter name. It's not special.
yeah
yes but conventions are good
In Python, it's explicit, and named by the programmer. In other languages it's implicit and has a keyword for the name.
I'm not sure either approach is necessarily better, but Python's is definitely weird.
How.
ohkay wait just confirming... if u dont pass self parameter.. u cannot access self.variables right.. or can u?
yeah, you need a variable to store the instance
less error prone if the object is passed in implicitly like in c++
it may or may not be self
that's just a convention
and PEP8 says that
inb4 esoteric code to bypass that
i think you're even allowed to do Class.method(x) if x isn't an instance of Class 
What do you mean by "if you don't pass" it? It's passed automatically when you call a method on an instance.
You are, yep.
staticmethod (/s)
In Python, a static method is just one that doesn't bind to the instance it's called on
The special thing that @staticmethod does is to disable the normal descriptor behavior of the function it's decorating
And only in Python will the difference between tabs and spaces cause the interpreter to have a heart attack.
why does the person code in notepad
oh wait
even notepad++ has an option to convert tabs to spaces
ive actually had problems with this though. Where it looks like the indentation is fine but python complains
your editor should have an option to convert tabs to 4 spaces (unless you use notepad)
you could just click that button and it fixes that
Yeah. That's also a fair hit, I think. It's bad that code that looks correct on a user's screen might be invisibly wrong.
That wouldn't fix it, if the editor was originally showing tabs as 8 spaces.
oh i was talking about while function definition
nvm
sublime text and vscode also show spaces and tabs (with dots etc)
there are some valid points - some thing that actually do have a problem
but they are mixed in a load of baloney 
also would help if he calmed his voice against python devs
sounds like a personal vendetta smh
which editor does that by default
Most? Everything from vim to notepad
aren't tabs 4 spaces
well yes
Indent levels are usually 4 spaces, at least in Python, and you get 4 spaces of indenting when you press the tab key. Those facts are orthogonal to the question of how a tab 0x09 byte in the file is displayed.
huh... just checked, notepad++ uses 4 spaces by default for tabs
same for vscode and sublime
i dunno about vim tho
oh god i have seen projects with 2 tabs as indents 
discord indents:
black to the rescue
You're 100% sure it's a 0x09 byte?
Right, whole different thing
tab lol
have you seen notepad tabs lol
2 spaces π’
discord used 2 spaces lol
my tab:
tab
lmao
ye two spaces
If you do:
with open("foo.txt", "w") as f:
f.write("a\tb\n")
And then open the file in each of those editors, how does it display,
>>> print("\te")
e
>>>
wtf
probably different font
Most editors I know will, by default, show that as an a in column 1 and a b in column 9
Good editors will display it as an a in column 1 and a b in column 9, but the 7 blank spaces will be colored differently or have some light dots filled in so they can't be mistaken for actual spaces
readline.redisplay()
AttributeError: module 'readline' has no attribute 'redisplay'
>>>
anaconda install is shitting itself
sublime
lemme try notepad, brb
notepad uses... a lot of spaces
Yep, that's what I expect.
notepad++ is fine tho
!e ```py
print("a\tb")
@solid elbow :white_check_mark: Your eval job has completed with return code 0.
a b
Hah, that's weird.
it's just notepad which has a problem 
Run that interactively in a terminal and I bet it looks like 7 spaces.
"\b" is the backspace character am i correct?
others just use 4 spaces (idk about vim)
yup!
Every terminal I know of sets tabstops every 8 characters by default.
Not just terminal based IDEs - terminals themselves.
is tab tab but not space
There's no IDE involved there. Your terminal is deciding how to display the 0x09 byte, it's choosing to display it as a bunch of blank spaces up til the next column that's a multiple of 8
yep, i could see how that's gonna be a huge problem lol
what is the problem, i cant quite follow lol
8 spaces would be... like 2 indents to a python user
the code won't be readable anymore ig
We're discussing someone's criticism of the fact that Python grants syntactic significance to invisible characters
Which are rendered differently in different environments
In practice it's not a huge problem - the convention is to use spaces for indenting in Python, never tabs, and as long as you do that everything is fine.
It's an annoying problem that often trips up beginners, though.
the first thing beginners need to install is black and flake8
Python has a whole special type of SyntaxError just to tell you that you've mixed tabs and spaces in your indent.
Neither black nor flake8 prevent this problem
black formats it on ctrl+s tho
black would fail to parse the code because of the incorrect indenting, just like the interpreter does.
so if the code was being save regularly (when it was just tabs), it's gonna be all 4 spaces
It can't format code it can't parse
yeah, it won't fix it after it's been borked
If you write your code with tabs, then black changes it to use spaces, and then you add more tabs for indenting into it, black can't fix it a second time.
oh
In that sense fixing it on ctrl-s was worse than doing nothing at all
yes 
time for a new code formatter - white (i bet it wont work 2)
Because if it was all tabs, things would have been fine, too
welp... ig PyCharm has tabs -> 4 spaces by default
but sublime and np++ needs it to be configured
damn we are still at tabs π―
At the same time, many beginners make mistakes with indenting things differently than what the code gets parsed as in languages without significant whitespace
formatting step 1: convert all tabs to 4 spaces
And errors > bugs
git clone psf/black
meanwhile discord tab 
You're not wrong, though auto formatters can help with that.
step2 convert all lambda to def, step3 convert all list comp to for loop
i hate it when it does that >:((
step 3 golf
wait
Yeah, if you have well setup tooling, both options do great
list comps are nice 
yes
yes
A C or Java formatter can reindent the file to match how it's syntactically interpreted.
the new code formatter makes your code worse
nvm a simple obfuscator can do all that
Better yet, use my obfuscator
Jk that's coming soonβ’οΈ
have you obfuscated your obfuscator yet
use your obfuscator to obfuscate your obfuscator
No because that would de optimize my deoptimizer
And I want my deoptimizer to run at max performance
It's interesting that the author of that piece chose to talk about the lack of privates, but didn't mention the descriptor protocol, which is why Python doesn't need getters and setters like the languages the author likes do
i never use __private tbf
It's also telling that the author pointed to name mangling with two underscores rather than the convention of a single underscore for private
The author is just wrong about name mangling being the preferred way to make privates.
Yeah, haven't seen name mangling often
Yeah, it's needed in relatively specialized cases.
where is it needed tho?
i feel this ot channel is too advanced i cant fit in lol
same i am just staring blankly at half the stuff..
When making a public open class that needs private members users can't override
You need name mangling when you want to add a private attribute or method to an existing class, where there is a chance that an existing subclass of that class has already used that same name for one of its own private attributes or methods
oh
just do eval() on a long string of encrypted text and decrypt it lol
is there a decorator for private method
Nope. Python doesn't have privates.
or i can just do if __name__ != "__main__" and leave
what about self.__var_name?
The convention is to denote something that users shouldn't touch by putting a single underscore at the start of its name.
this won't allow us to access the var
That's not private, it's name mangled.
i thinkβ’οΈ
and what's that?
You can still access it.
what
It just changes the name.
what does __name__ equal if it doesn't equal '__main__'
the name of the file
it it doesn't equal to main that means it's imported iirc
ok
if it's main that means it's running the file
no, its value lol
idk
^
ye ic
!e ```py
class Foo:
def init(self):
self.__x = 42
f = Foo()
print(f._Foo__x)
@solid elbow :white_check_mark: Your eval job has completed with return code 0.
42
pyinstaller sucks, i can just make the file format to .exe and run it with python file.exe
ahhhhhhh
but the access syntax is quite weird
Sure. Its name has been changed to make conflicts unlikely.
but it doesnt work as an actualy exe smh. i got it working after several hours and stack overflow visits
The purpose of name mangling is to avoid choosing a name for something that conflicts with a subclass or superclass. It's got nothing to do with privacy
no it does work like an exe, just not how you expected how
also what happens if you do setattr(self, "test with space", 1)?
unrelated but 
Works fine.
you cant just run it, you gotta python run it tho
but how do you access it
you can, but most likely to be errored out
It adds a "text with space" key to self.__dict__
!e
class Foo:
def __init__(self):
self.x = 42
f = Foo()
print(f.x)```
@spare lance :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 6, in <module>
003 | AttributeError: 'Foo' object has no attribute '__x'
wait why
With getattr.
ah I see
!e print("\Foo\bar")
@dire siren :white_check_mark: Your eval job has completed with return code 0.
\Fooar
yay backspace works
Because names with two leading underscores and without two trailing underscores are name mangled.
!e print(chr(96)*2+"\b"+chr(96))
@dire siren :white_check_mark: Your eval job has completed with return code 0.
```
weered
ohh wdym my by mangled tho?
The name mangling prefixes them with a single underscore and the name of the class they're defined in
The attribute gets a different name than the name that appears in the code.
yes mango is one of the sweetest fruit
?
i liek to delete every message i sent, so probably you didn't see something
Ahh
the way u deleted ur nickname?
And the purpose of that mangling isn't to make it private - after all, the new name is totally predictable. The purpose of the mangling is to prevent the name from conflicting with a parent or child class that might want to use the same name.
he sent "mangoed :(" before godlygeek's "Yum"
i cant actually delete my nickname, i'll die for invisible names
Mango lassi is the best Indian dessert π
Indeed
Mango lassi is one the best desserts period.
idk man i like jalebis more
u actually can since discord then automatically sets ur nick to ur username
I can set it to a special char
and mess it up
idk i like normal lassi more than mango lassi
Don't, though. π
We do give infractions for annoying nicks, heh
I don't know that I've ever tried the non mango version
the .catify nickname annoyed dogs lovers
Not really
i like both
i dont know the number of dog lovers i have annoyed then
I personally am a dog lover and I don't give a shit about the .catify command
.catify @clear plume
@clear plume ααα’
i mean u should try it if u get a chance sometime.. its delicious
Discord really has trouble with the Unicode RTL character. It does weird things like put the "edited" in the wrong spot if you edit the message
i see a lot of people say why not both for cats and dogs, by why not neither lol
This is aβ« message
indeed
No but, why ping me
My main is Python π
Im going to start revising my C++ today and continue working on my video editing software(Python)
i just thought itd be cool to share since your learning cpp
why use python when you can go to visual studio and drags stuff to make a gui in c#
oh you meant about the static assert thing
yeah idk
Unnamed namespaces are handy. The C equivalent is file level statics
Oo
thanks!
Yeah
i need a ton of help with cpp
cause
like,
doesn't look "wrong spot" for me, "This is a message edited" seems weird
its not my main
Your example with the unnamed namespaces is basically equally to
static int foo = 1;
learncpp.com is a great resource
i know as a python enjoyer, i would not recommend people to use Tutorials for code based tutorials
I've seen it do that before. Though maybe they've fixed that? Or maybe it was only the browser version?
logic and concept based is fine
yt tutorials, full form: whY waTch tutorials
wait what.. how did u manage to achieve this
I did try that
but the problem is
i get build warning
ik build warnings are good
but
but im not used to em 
Lol, yeah. What platform are you using Discord on?
cause python give no warnings
copy the whole sentence and edit add a trailing whitespace (what pep8 hates) it should work
they give error or no error
:D
yeah but it is nice to have compile time errors becuase youll catch errors that would otherwise go unoticed if everything was caught at runtime
I've seen lots of bugs in Python code that would have been caught at compile time in other languages. Things like except blocks referring to variables that don't exist
They're not exercised when everything works fine, so it's easy to miss that they'd be broken if they run
i wish try except can catch syntax error
why
bruh why tho
just switch to compiled language
or a compiled scripting language. Theres elixer julia
It can - the try except just needs to be in a different module
The module importing the syntactically incorrect one can handle the syntax error and do something about it.
:O
In [24]: try:
...: eval("2+")
...: except SyntaxError:
...: print("here")
...:
here
hmph
Yep, or that.
SyntaxError is catchable, but a try block inside an a syntactically incorrect file can never run, because the interpreter fails to even parse and compile the file, so it never gets a chance to run any code inside it
hey can i ask you a c++ question?
hmm ill try
If i have a type that is a alias of of a type* how do i get the base type from the pointer type?
That's an odd thing to do, though it's possible with some metaprogramming...
Yep, just found it myself.
That said, I've programmed in C++ professionally for 10 years without ever once needing that - if you're new to C++, it's definitely not something you should need.
yeah i know the type of it. its void* so i just need void
i dont really need it
just curious
this is too fun
smh
sry
lol
@dire siren :white_check_mark: Your eval job has completed with return code 0.
SPEED RUN EVAL 15
That's enough of that.
sry
lol
can i run sagemath in colab?
its build on python but i cannot find something which does, neither is it on pip i think.
or i mean what should i do?
my pc is not too good, thats why i prefer colab.
is vsc the best ide for like c++ on ubuntu?
it works but i hear clion is better
that is indeed a message
This is aβ« message
there's a specific unicode doing that
you can try to find it
have fun
!e print("β« message")
@dire siren :white_check_mark: Your eval job has completed with return code 0.
β« message
yay
You are not allowed to use that command here. Please use the #bot-commands channel instead.
!raw 867328449768062986
== Raw message ==
This is aβ« message
nice try
!charinfo
characters
lmao
!charinfo This is aβ« message
\u0054 : LATIN CAPITAL LETTER T - T
\u0068 : LATIN SMALL LETTER H - h
\u0069 : LATIN SMALL LETTER I - i
\u0073 : LATIN SMALL LETTER S - s
\u0020 : SPACE -
\u0069 : LATIN SMALL LETTER I - i
\u0073 : LATIN SMALL LETTER S - s
\u0020 : SPACE -
\u0061 : LATIN SMALL LETTER A - a
\u202b : RIGHT-TO-LEFT EMBEDDING - β«
\u0054\u0068\u0069\u0073\u0020\u0069\u0073\u0020\u0061\u202b\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u006d\u0065\u0073\u0073\u0061\u0067\u0065
\u202b: RIGHT-TO-LEFT EMBEDDING - β«
this is a message too
hello
This is aβ« message
did u carriage returned?
wdym
the unicode i meant
@dire siren :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | print("("
003 | ^
004 | SyntaxError: unexpected EOF while parsing
it'll die if i do that normal
wait but what is the unicode for it wotah
\u202b
!e print(chr(0x202b))
@dire siren :white_check_mark: Your eval job has completed with return code 0.
β«
^ grab this char above
β«β«helloβ«
worldβ«
dont you try to edit the world
@spare lance :white_check_mark: Your eval job has completed with return code 0.
hello β« world
this message is β« edited
You are not allowed to use that command here. Please use the #bot-commands channel instead.
@dire siren :white_check_mark: Your eval job has completed with return code 0.
111
!e print(int("111",2))
@dire siren :white_check_mark: Your eval job has completed with return code 0.
7
!e print(69+420)
@dire siren :white_check_mark: Your eval job has completed with return code 0.
489
k doesnt work for this bye
!e print(int("489",16))
@spare lance :white_check_mark: Your eval job has completed with return code 0.
1161
!e print(int("1161",8))
@spare lance :white_check_mark: Your eval job has completed with return code 0.
625
ah yes here we have the number @dire siren
What is this bot commands
fuck this
i give up
anime is officially dead
i probably just need a bigger dataset but i just don't care anymore
r u still doing grayscale anime gen
but its better than last time... and colourful too


