#esoteric-python
1 messages · Page 100 of 1
awww
;-;
; ;
You need a lot of extra stuff to create a code object to be executed
because the source looks like this mess:py C=lambda f:(lambda *args:(lambda o:(lambda g:{None}|{None for _ in iter(lambda:(lambda G:(not G)or o.append(G.pop()))(list((lambda:(yield from(g(*o.pop())for _ in(None,))))())),None)}and o.pop())(f(lambda *a:o.append(a)or next(iter(())))))([args]))
And I don't even know what it does
I've only been able to use it to raise StopIteration
!e ```py
[0][1]
@floral meteor :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | IndexError: list index out of range
that raises IndexError
why wouldn't it
i.e. to make an os.system command raise error, I'd write it as:
try:[0][exit_code:=os.system(command)]
except IndexError:print(f"Command errored out with exit code {exit_code}")
instead of
try: assert not (exit_code:=os.system(command))
except AssertionError:print("Command no worky")
It might be broken in this version of Python.
ah
Before 3.9:
is_error=[1,0][[1,0][os.system('command')and 1]and(print("worky")or 1)or(print("No worky")or 0)]
after 3.9:
[1,0][is_error:=os.system('command')and 1]and print("worky")or print("no worky")
!e ```py
print([1,0][(is_error:=import('o'+'s').system('ls')and 1)]and"worky"or "no worky","\nexit code:",is_error)
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | no worky
002 | exit code: 1
!e ```py
{print([1,0][(is_error:=import('os').system(this)and 1)]and"worky"or "no worky","\nexit code:",is_error)for this in ['ls','dir','cd']}
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | no worky
002 | exit code: 1
003 | no worky
004 | exit code: 1
005 | no worky
006 | exit code: 1
You have to create an instance of CodeType, which is definitely a bit overwhelming if you don't know it lol
the bytes are just one argument to the constructor
ah
Easiest way is to use an existing object and just override some of its attrs
also, more on that set iterator to substitute a while loop, how does it exactly work?
like the
{print("<message>")for _ in iter(...,False)}
iter() with 2 args creates an iterator that, on each step, calls the 1st arg, checks if it equals the 2nd arg and halts if that's true
the set just gets rid of the duplicate values
how do I get it to return values?
because I can't do a walrus inside comprehension
Something like this?
while not _p:_p=(lambda _pp:_pp[[]!=[]]if _pp[[]!=[]]==_pp[[]==[]]else['',print("PASSWORDS DO NOT MATCH")][[]!=[]])([_getpass('new password>'),_getpass('confirm password>')])
->
_p=[(_p:=[]),{print("PASSWORDS DO NOT MATCH, YOU FOOL") for _ in iter((lambda:[_p.append(_getpass('new password>'),_p.append(_getpass('confirm password>'),_p[0]==_p[1]][2]),False)},_p[0]][2]
or...
_p=[(_p:=[]),{print("PASSWORDS DO NOT MATCH, YOU FOOL") for _ in iter((lambda:[_p.append(_getpass('confirm password>')),_p[0]][1]),_getpass('new password>'))},_p[0]][2]
whoops its wrong way aroun
now if it's wrong once there's no way out
!e ```py
_p=[(_p:=[]),{(print("PASSWORDS DO NOT MATCH, YOU FOOL"),_p.pop(()==()),_p.pop(()!=()))for _ in iter((lambda:[_p.append('password1'),_p.append('password1'),_p[~([]!=[])]==_p[~([]==[])]][2]),True)},_p[~([]!=[])]][2]
print(_p)
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
password1
!e ```py
_p=[(_p:=[]),{(print("PASSWORDS DO NOT MATCH, YOU FOOL"),_p.pop(()==()),_p.pop(()!=()))for _ in iter((lambda:[_p.append('password1'),_p.append('not the password'),_p[~([]!=[])]==_p[~([]==[])]][2]),True)},_p[~([]!=[])]][2]
print(_p)
@floral meteor :x: Your eval job timed out or ran out of memory.
001 | PASSWORDS DO NOT MATCH, YOU FOOL
002 | PASSWORDS DO NOT MATCH, YOU FOOL
003 | PASSWORDS DO NOT MATCH, YOU FOOL
004 | PASSWORDS DO NOT MATCH, YOU FOOL
005 | PASSWORDS DO NOT MATCH, YOU FOOL
006 | PASSWORDS DO NOT MATCH, YOU FOOL
007 | PASSWORDS DO NOT MATCH, YOU FOOL
008 | PASSWORDS DO NOT MATCH, YOU FOOL
009 | PASSWORDS DO NOT MATCH, YOU FOOL
010 | PASSWORDS DO NOT MATCH, YOU FOOL
011 | PASSWORDS DO NOT MATCH, YOU FOOL
... (truncated - too many lines)
Full output: too long to upload
I guess that works
[(_p:=[]),{(print("PASSWORDS DO NOT MATCH, YOU FOOL"),_p.pop(()==()),_p.pop(()!=()))for _ in iter((lambda:[_p.append(_getpass('new password>')),_p.append(_getpass('confirm password>')),_p[~([]!=[])]==_p[~([]==[])]][2]),True)},_p[~([]!=[])]][2]
your terminal colour hurts
The music I'm listening to hurts
this line of code hurts:
# IMPORT STUFF AND ENCRYPT TOKEN
import os,sys;os.system("");_get_encrypted_token=lambda:(_t:=(_getpass:=__import__('getpass').getpass)("copy and paste token here (ENTER to skip)>"))and((lambda source,key:(not key)and source or[len(source)<len(key)and(key:=key[:len(source)])or len(source)>len(key)and(key:=(key*(len(source)//len(key)+(()==())))[:len(source)]),(_s:=[ord(c)for(c)in list(source)]),(_k:=[ord(c)for(c)in list(key)]),(_p:=[]),[_p.append((((e-32)+(_k[i]-32))%95)+32)for i,e in enumerate(_s)],''.join([chr(n)for(n)in(_p)])][-1])(_t,[(_p:=[]),{(print("\x1b[31mPASSWORDS DO NOT MATCH, YOU FOOL\x1b[0m"),_p.pop(()==()),_p.pop(()!=()))for _ in iter((lambda:[_p.append(_getpass('new password>')),_p.append(_getpass('confirm password>')),_p[~([]!=[])]==_p[~([]==[])]][2]),True)},_p[~([]!=[])]][2]))or''
!e ```py
import os,sys;os.system("");from getpass import getpass as _getpass;_get_encrypted_token=lambda:(_t:="AAAAAAAAAAAAAAAAAAAAAAAAAA")and((lambda source,key:(not key)and source or[len(source)<len(key)and(key:=key[:len(source)])or len(source)>len(key)and(key:=(key*(len(source)//len(key)+(()==())))[:len(source)]),(_s:=[ord(c)for(c)in list(source)]),(_k:=[ord(c)for(c)in list(key)]),(_p:=[]),[_p.append((((e-32)+(_k[i]-32))%95)+32)for i,e in enumerate(_s)],''.join([chr(n)for(n)in(_p)])][-1])(_t,[(_p:=[]),{(print("\x1b[31mPASSWORDS DO NOT MATCH, YOU FOOL\x1b[0m"),_p.pop(()==()),_p.pop(()!=()))for _ in iter((lambda:[_p.append("password1"),_p.append("password1"),_p[~([]!=[])]==_p[~([]==[])]][2]),True)},_p[~([]!=[])]][2]))or''
print(_get_encrypted_token())
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
2#55914&R2#55914&R2#55914&
that works i can't believe it
I have cursed it further:
sys=[__import__('sys'),(os:=__import__('os')).system(""),(_get_encrypted_token:=lambda:(_t:=(_getpass:=__import__('getpass').getpass)("copy and paste token here (ENTER to skip)>"))and((lambda source,key:(not key)and source or[len(source)<len(key)and(key:=key[:len(source)])or len(source)>len(key)and(key:=(key*(len(source)//len(key)+(()==())))[:len(source)]),(_s:=[ord(c)for(c)in list(source)]),(_k:=[ord(c)for(c)in list(key)]),(_p:=[]),[_p.append((((e-32)+(_k[i]-32))%95)+32)for i,e in enumerate(_s)],''.join([chr(n)for(n)in(_p)])][-1])(_t,[(_p:=[]),{(print("PASSWORDS DO NOT MATCH, YOU FOOL"),_p.pop(()==()),_p.pop(()!=()))for _ in iter((lambda:[_p.append(_getpass('new password>')),_p.append(_getpass('confirm password>')),_p[~([]!=[])]==_p[~([]==[])]][2]),True)},_p[~([]!=[])]][2]))or'')][[]!=[]]
You can't?
huh, okay
here:
@snow beacon
alright, i get this output:
720
13
13
Traceback (most recent call last):
File "<stdin>", line 147, in <module>
File "<stdin>", line 59, in <lambda>
File "<stdin>", line 61, in <lambda>
File "<stdin>", line 59, in <lambda>
File "<stdin>", line 61, in <lambda>
File "<stdin>", line 59, in <lambda>
File "<stdin>", line 61, in <lambda>
File "<stdin>", line 59, in <lambda>
File "<stdin>", line 61, in <lambda>
File "<stdin>", line 59, in <lambda>
File "<stdin>", line 61, in <lambda>
File "<stdin>", line 59, in <lambda>
File "<stdin>", line 61, in <lambda>
File "<stdin>", line 59, in <lambda>
File "<stdin>", line 65, in <lambda>
File "<stdin>", line 59, in <lambda>
File "<stdin>", line 65, in <lambda>
File "<stdin>", line 59, in <lambda>
File "<stdin>", line 65, in <lambda>
File "<stdin>", line 59, in <lambda>
File "<stdin>", line 64, in <lambda>
File "<stdin>", line 57, in <lambda>
NameError: name 'raw_input' is not defined
from this code:
https://gist.github.com/brool/1679908
why?
Statementless Python -- originally at http://www.pick.ucam.org/~ptc24/yvfc.html - yvfc.py
because raw_input is python2 lol
!e ```py
def protect(*A):
def D(f):
protected={k:globals()[k]for k in A}
def wrapper(*args, **kwargs):
g = globals();previous={k:g[k]for k in A if k in A};g.update({k:protected[k]for k in A});e=None
try:out = f(args, **kwargs)
except Exception as r:e=r
[k in previous and(g.update({k:previous[k]})or 1)or(g.pop(k))for k in A]
if e is not None:raise e
else:return out
return wrapper
return D
a=42
@protect("a")
def multiply(n):return an
print(multiply(10))
a=10
print(multiply(10))
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | 420
002 | 420
You set it, then set it back whenever you call the decorated multiply function.
When protect("a")(...) is called, a gets stored. When the function it returns is called, it sets a to the stored value.
noice
!e ```py
import sys
class _self_reference():
def call(self,args):f=lambda a:None;f.code=sys._getframe(1).f_code;return f(args)
def getitem(self,n):return lambdaargs:[((f:=(lambdaa:None)).setattr("code",sys._getframe(n+1).f_code)),f]1
self = _self_reference()
fac=lambda n:n<=1 and 1 or nself(n-1)
print(fac(4),fac(2),fac(3),fac(5))
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
24 2 6 120
oooh
!e ```py
import sys
class _self_reference():
def call(self,args):f=lambda a:None;f.code=sys._getframe(1).f_code;return f(args)
def getitem(self,n):return lambdaargs:[((f:=(lambdaa:None)).setattr("code",sys._getframe(n+1).f_code)),f]1
self = _self_reference()
fac=lambda n:n<=1 and 1 or nself(n-1)
print(fac(320))
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
21161033472192524829557170410776298658794639108376130676557783015578090330844472167861788371083170940722591241807108382859295872641348645166391260040395583908986502774347856154314632614857393087562331369896964916313777278292965202780626304839725254323083321245935920345445760469315716688808181386083935737705284353395869520861742156127496385090743602309049820934917134755461873012945704938955132724663075880436995904093654709349552656965610546540372048421026608925808493978164019986593442564905462745669412326023291812269608558332157759989142549649265359278848084868920655698461242425344000000000000000000000000000000000000000000000000000000000000000000000000000000
alright how does that one work?
Altering call frames, it seems like
!e (eval(eval(print("test"))))
@sudden willow :x: Your eval job has completed with return code 1.
001 | test
002 | Traceback (most recent call last):
003 | File "<string>", line 1, in <module>
004 | TypeError: eval() arg 1 must be a string, bytes or code object
print returns None.
It always gives me pause when you post something then ask how it works. Where are you finding these?
!e (eval(str(eval(print("test")))))
@toxic jewel :x: Your eval job has completed with return code 1.
001 | test
002 | Traceback (most recent call last):
003 | File "<string>", line 1, in <module>
004 | TypeError: eval() arg 1 must be a string, bytes or code object
if you have bytecode in a string, is it possible to execute it within the program?
@frozen holly
True esoteric python would be reading .png files structured like .jpg files as bytes that are convered into code, compressed into a .zip, reread again as bits, and used as a seed value that tells a code generator what Java code it should put into memory
print returns None
!e ```py
x = print("hello world")
print(x if x is not None else "None")
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | hello world
002 | None
also doesn't look like you actually called the eval function
@snow beacon wherever I find code, and for whatever reason, i like to know how and why it works before I use it.
For example:
print(eval(''.join([....__ge__(()).__str__()[this]for this in(0,1,~3,~4)])))
That's None, right?
Yes
Wait, gl? Is that a comparison operator?
I thought it was gt.
Or that.
Yeah that
gl would be ne
So it strings, then accesses those indices, which spells None, then evals
!e py print(eval(''.join([....__ge__(()).__str__()[this]for this in(0,1,~3,~4)])))
@dark loom :white_check_mark: Your eval job has completed with return code 0.
None
yo what
!e py print(eval(''.join([....__le__(()).__str__()[this]for this in(0,1,~3,~4)])))
@dark loom :white_check_mark: Your eval job has completed with return code 0.
None
I am confuz
can you see the data go brrrr?
@dark loom
>>> ...
Ellipsis
>>> ....__le__(())
NotImplemented
>>> ....__le__(()).__str__()
'NotImplemented'
>>> ....__le__(()).__str__()[:1]
'No'
>>> [....__le__(()).__str__()[this]for this in(0,1,~3,~4)]
['N','o','n','e']
>>> ''.join(_)
'None'
>>> eval(_)
>>> str(_)
"None"
>>> ~3
-4
...<=() is not implemented
!e py print(eval(''.join([....__le__(()).__str__()[this]for this in(0,2,~3,~4)])))
@dark loom :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | File "<string>", line 1, in <module>
004 | NameError: name 'Ntne' is not defined
nice
0,1 not 0,2
ik
Ntne isn't anything
I wanted to do that to see what would happen lol
if Ntne was defined....
right right
!e ```py
Ntne=4
print(eval(''.join([....le(()).str()[this]for this in(0,2,~3,~4)])))
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
4
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
Ntne
!e py print(eval(''.join([....__le__(()).__str__()[this]for this in(0,2,~3,~4)])))
@dark loom :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | File "<string>", line 1, in <module>
004 | NameError: name 'Ntne' is not defined
if I actually removed the eval
lel
... well you clearly know a lot more about this language than I do lol
"~3" you've already lost me
~ is bitwise not
3 = 0011, so negating is 1100, where the first bit is a signed bit? e.g. -4?
>>> ~3
-4
>>> ~1
-2
>>> ~-1
0
>>> ~0
-1
>>> ~2
-3
-x-1 iirc
so if I did ~16
-17
@dark loom :white_check_mark: Your eval job has completed with return code 0.
-17
neat
>>> my_list[~a]==reversed(my_list)[a]
True
-16-1
16 = 0001 0000
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
-1
I'm so confused lol
see all 1s means -1
leading 1s you mean?
you 'plus' 1 to 1111 1111, you get 1 0000 0000 but because the ~9th index does not exist in memory, that doesn't get switched so it becomes 0000 0000
right, with you so far
hence why you 'minus' one from 0000 0000 the machine copes by pretending there's a 1 0000 0000 and makes 1111 1111
can't remember why it's called two's compliment but that's what it does
sooo, basically you reverse it, add 1 to that binary number, and make it negative
e.g. 32 | -33 = -1
yeah, that's the binary or operator, not to be confuse with the python keyword or
if you compare a | ~a it will return -1
I'm familiar with bitwise operations, it's been a while since I learned 2s compliments though
!e ```py
print(4||5)
@floral meteor :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | print(4||5)
003 | ^
004 | SyntaxError: invalid syntax
huh
it was taught to me different
|| in matlab is equivalent to or in python, but it isn't lazy in matlab
the laziness of or in python can be exploited
because we're in #esoteric-python we're gonna exploit that to put everything on one line
lol
for example...
!e ```py
((rand:=import('random').randint)(0,2)and print('a'))or print('b');((rand:=import('random').randint)(0,2)and print('a'))or print('b');((rand:=import('random').randint)(0,2)and print('a'))or print('b');((rand:=import('random').randint)(0,2)and print('a'))or print('b')
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | b
002 | b
003 | a
004 | b
005 | b
we should have a channel called obfuscated-python to obfuscate which channel to use
but obfuscated python is a subset of esoteric python
is the __import__('random') equivalent to import random
it's not necessarily esoteric to be confused, but confused is esoteric
yes
but in expression form
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
<bound method Random.randint of <random.Random object at 0x5587a3a583c0>>
!e py print((random:=__import__('random')).randint(0,10))
@dark loom :white_check_mark: Your eval job has completed with return code 0.
1
i mean, you literally just used the dunder import
yes
__import__('random').randint
whenever someone says that my mind immediately jumps to dunder mifflin
I assume that's the name for the weird looking import
!e ```py
print((random:=import('random')).randint(0,10),random.sample([0,1,2,3,4,5,6,7,8,9],1)[-0])
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
10 4
lol it was just by chance they were the same
haha negative 0
8 [8]
yes
!e py import random print(random.sample([0,1,2,3,4,5,6,7,8,9], 5))
@dark loom :warning: Your eval job has completed with return code 0.
[No output]
!e print(import('random').sample([0,1,2,3,4,5,6,7,8,9], 5))
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
[0, 5, 3, 8, 4]
!e py import random print(random.sample([0,1,2,3,4,5,6,7,8,9], 5))
@dark loom :white_check_mark: Your eval job has completed with return code 0.
[1, 0, 4, 9, 7]
!e ```py
print(int(''.join([str(this)for this in import('random').sample(range(10),5)])))
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
47280
by editing it really quickly
ah
it has a rapid timeout
!e py print("hi")
@dark loom :white_check_mark: Your eval job has completed with return code 0.
hi
nice
somehting like
timeout /t 5
__import__('time').sleep(5)
pause(5)
or whatever the equivalent is in whatever language they're coding in
I would be surprised if it was anything other than python
now=(time:=__import__('time').time)();{None for _ in iter(lambda:time()-5<now,False)}
the obfuscated version of....
!e ```py
import time
wait = time.sleep
this_long = 5
wait(this_long)
did it work?
that's a lot more than 5 seconds
oh
!e ```py
import time
wait = time.sleep
this_long = 5
wait(this_long)
@floral meteor :warning: Your eval job has completed with return code 0.
[No output]
thonk
why is it still typing?
lmao
!e ```py
now=(time:=import('time').time)();{print(time())for _ in iter(lambda:time()-20<now,False)}
@floral meteor :x: Your eval job timed out or ran out of memory.
001 | 1611119600.8488405
002 | 1611119600.848934
003 | 1611119600.8489423
004 | 1611119600.8489504
005 | 1611119600.8489554
006 | 1611119600.8489604
007 | 1611119600.8489668
008 | 1611119600.8489728
009 | 1611119600.8489783
010 | 1611119600.8489835
011 | 1611119600.8489895
... (truncated - too many lines)
Full output: too long to upload
!e ```py
now=(time:=import('time').time)();{None for _ in iter(lambda:time()-20<now,False)}
thonk
@floral meteor :warning: Your eval job timed out or ran out of memory.
[No output]
Your eval job timed out or ran out of memory.
well it didn't run out of memory because it's in a set so it timed out
r00d
okay so I have some code here
import os
import random, nt
os.system("")
def print_green(func):
def wrapper(*args, **kwargs):
print('\033[32m') # "\033["+str(random.sample([30, 32, 30], 1)[0])+"m", if you want random colours, end='\033[0m'
try: func(*args, **kwargs)
except KeyboardInterrupt: print('\033[0m')
except SystemExit: print('\033[0m')
finally: print('\033[0m')
return wrapper
def double_epilepsy(func):
def wrapper(*args, **kwargs):os.system('color 41')or func(1,*args,epilepsy=1,**kwargs)
return wrapper
@double_epilepsy
@print_green
def random_text(coloured:bool=False, suppress_special_characters: bool = False, binary: bool = True, spaces: bool = True, tailored_newlines: bool = False,epilepsy=0, *_):
count = 0;switch=0
while True:
count=(tailored_newlines and(count+1%os.get_terminal_size()[0]-10))or 1;this=ord(nt.urandom(1))
print('\n' if tailored_newlines and not count else random.sample([random.randint(0, 1),chr(this) if this >= 32 and this!=127 or not suppress_special_characters else ' '*(spaces+1),' '*spaces][0 if binary else 1:], 1)[0],
sep=(coloured and"\033["+str(random.sample([30, 32, 30], 1)[0])+"m" or spaces*' '*random.randint(0,3)),
end=[(switch:=epilepsy and(switch and os.system('color 14')or os.system('color 41'))or not switch),(coloured and '\033[0m' or '')+(coloured and '\033[32m'or'')][1])
if __name__ == '__main__':
while not all([(_bin:=input('b>'))]+[this in['0','1']for this in _bin]):print('.')
random_text(*(bool(int(this))for this in list(_bin)))
For some reason, this makes it flash red and blue, but doesn't print the results until it's interrupted, and even then it takes a long time for a few characters to print, but without the epilepsy it prints rapidly and looks like the matrix, but stays green on black background
!e ```py
import os
import random, nt
os.system("")
def random_text(coloured:bool=False, suppress_special_characters: bool = False, binary: bool = True, spaces: bool = True, tailored_newlines: bool = False,epilepsy=0, _):
count = 0;switch=0
while True:
count=(tailored_newlines and(count+1%os.get_terminal_size()[0]-10))or 1;this=ord(nt.urandom(1))
print('\n' if tailored_newlines and not count else random.sample([random.randint(0, 1),chr(this) if this >= 32 and this!=127 or not suppress_special_characters else ' '(spaces+1),' 'spaces][0 if binary else 1:], 1)[0],
sep=(coloured and"\033["+str(random.sample([30, 32, 30], 1)[0])+"m" or spaces' 'random.randint(0,3)),
end=[(switch:=epilepsy and(switch and os.system('color 14')or os.system('color 41'))or not switch),(coloured and '\033[0m' or '')+(coloured and '\033[32m'or'')][1])
if name == 'main':random_text((bool(int(this))for this in list('111')))
@floral meteor :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 2, in <module>
003 | ModuleNotFoundError: No module named 'nt'
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
['CLD_CONTINUED', 'CLD_DUMPED', 'CLD_EXITED', 'CLD_KILLED', 'CLD_STOPPED', 'CLD_TRAPPED', 'DirEntry', 'EX_CANTCREAT', 'EX_CONFIG', 'EX_DATAERR', 'EX_IOERR', 'EX_NOHOST', 'EX_NOINPUT', 'EX_NOPERM', 'EX_NOUSER', 'EX_OK', 'EX_OSERR', 'EX_OSFILE', 'EX_PROTOCOL', 'EX_SOFTWARE', 'EX_TEMPFAIL', 'EX_UNAVAILABLE', 'EX_USAGE', 'F_LOCK', 'F_OK', 'F_TEST', 'F_TLOCK', 'F_ULOCK', 'GRND_NONBLOCK', 'GRND_RANDOM', 'GenericAlias', 'MFD_ALLOW_SEALING', 'MFD_CLOEXEC', 'MFD_HUGETLB', 'MFD_HUGE_16GB', 'MFD_HUGE_16MB', 'MFD_HUGE_1GB', 'MFD_HUGE_1MB', 'MFD_HUGE_256MB', 'MFD_HUGE_2GB', 'MFD_HUGE_2MB', 'MFD_HUGE_32MB', 'MFD_HUGE_512KB', 'MFD_HUGE_512MB', 'MFD_HUGE_64KB', 'MFD_HUGE_8MB', 'MFD_HUGE_MASK', 'MFD_HUGE_SHIFT', 'Mapping', 'MutableMapping', 'NGROUPS_MAX', 'O_ACCMODE', 'O_APPEND', 'O_ASYNC', 'O_CLOEXEC', 'O_CREAT', 'O_DIRECT', 'O_DIRECTORY', 'O_DSYNC', 'O_EXCL', 'O_LARGEFILE', 'O_NDELAY', 'O_NOATIME', 'O_NOCTTY', 'O_NOFOLLOW', 'O_NONBLOCK', 'O_PATH', 'O_RDONLY', 'O_RDWR', 'O_RSYNC', 'O_SYNC', 'O_TMPFILE
... (truncated - too long)
Full output: https://paste.pythondiscord.com/huyejicizu.txt
!e ```py
import os
import random
nt=os
os.system("")
def random_text(coloured:bool=False, suppress_special_characters: bool = False, binary: bool = True, spaces: bool = True, tailored_newlines: bool = False,epilepsy=0, _):
count = 0;switch=0
while True:
count=(tailored_newlines and(count+1%os.get_terminal_size()[0]-10))or 1;this=ord(nt.urandom(1))
print('\n' if tailored_newlines and not count else random.sample([random.randint(0, 1),chr(this) if this >= 32 and this!=127 or not suppress_special_characters else ' '(spaces+1),' 'spaces][0 if binary else 1:], 1)[0],
sep=(coloured and"\033["+str(random.sample([30, 32, 30], 1)[0])+"m" or spaces' 'random.randint(0,3)),
end=[(switch:=epilepsy and(switch and os.system('color 14')or os.system('color 41'))or not switch),(coloured and '\033[0m' or '')+(coloured and '\033[32m'or'')][1])
if name == 'main':random_text((bool(int(this))for this in list('011')))
@floral meteor :x: Your eval job timed out or ran out of memory.
110ã001%´01=N0 *1 [1Ó 1 111 1 0 úC1 11 0O1110 y0 1, a 1 0 0 ú¡ù0I0 1 001 g 000} G 1 ø 0 0±v 1 n 1+1101 1 1 01101!11 1 [rî ¦0 10 ¬0011 Ñ0 0 00101> 0 s >1 0ì0 ä 1 0 00½ 0lê1X« T÷ 100~ Lä01§0 0$ 0 01 UTHWN3 0× 0zF 1 Èm1° yþö² 0Ü 0 0û 0 01õ h å0ú v¬ N01 1´ Z0|1 00w010 0+&Ê 0 0 10 0 00 B Ò 0 @0 00 01 \0 11ï 1 N0ú1¿ 0 0 91A .]»11 D0¸ 0 1010 110 ù01000 0%Ý fªú þ 0 î û0 01 10 ¨ ¥17* 1 àh 0 0 ù11 1 01 r1½1 1öD 00 01 1 0é ¢¸ óë01 0 { 0 0 h 0å01 101áu0101 ãb0 01*11 101 Õ111 0f´ 0 1Úß 10 10 ¿ 0010 1 0Î000 ýÐ11ɶ 0110£×0)1 _ 1 1 0 t|0=0l ù1 10 00 21101â 900 z1k*4\01 z 0Ì 0 00 1¦Ö0 1\å 1 1 î 1 ¡`ã 00, K 1Ë\ô 000Ô ;11 0 0 0 0 0 g 0Ø01\ Ë11 0Á·0ø 00 11á ?10 J Z 00 18 1_ 11 G1É1 µ 1 þ ^R 11 y0+ 010?ý 1010b¡0 0ô q Ê 0 00 _10 1 ; 1Ç1 1©101N 0ûG7 0¨eè¶m 1U11K 00 d1 01 1 0fä1q/ 0ýp11 1 00 B1 1| 0Ù
... (truncated - too long)
Full output: too long to upload
code goes brrrrrrrrrrrrrrrrrrrrrrrrr
!e ```py
for _ in type("",(),{"iter":lambda s:s,"next":lambda s:1})():
print(_)
weird while True loop i guess
@sick hound :x: Your eval job timed out or ran out of memory.
001 | 1
002 | 1
003 | 1
004 | 1
005 | 1
006 | 1
007 | 1
008 | 1
009 | 1
010 | 1
011 | 1
... (truncated - too many lines)
Full output: too long to upload
!e ```py
print(import('os').system("color 41"))
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
-1
!e ```py
[x for x in type("",(),{"iter":lambda s:s,"next":lambda s:1})()]
@sick hound :warning: Your eval job timed out or ran out of memory.
[No output]
print it
no
:P
!e ```py
{print(_) for _ in type("",(),{"iter":lambda s:s,"next":lambda s:1})()}
@floral meteor :x: Your eval job timed out or ran out of memory.
001 | 1
002 | 1
003 | 1
004 | 1
005 | 1
006 | 1
007 | 1
008 | 1
009 | 1
010 | 1
011 | 1
... (truncated - too many lines)
Full output: too long to upload
try that
lol
type("",(),{"__iter__":lambda s:s,"__next__":lambda s:1})()
can i even golf this further?
i'm not sure if there's something i can inherit
to remove the __iter__
if you want something to golf, I would love this to be shorter:
print([(_getpass:=__import__('getpass').getpass),(_p:=[]),{(print("PASSWORDS DO NOT MATCH, YOU FOOL"),_p.pop(()==()),_p.pop(()!=()))for _ in iter((lambda:[_p.append(_getpass('new password>')),_p.append(_getpass('confirm password>')),_p[~([]!=[])]==_p[~([]==[])]][2]),True)},_p[~([]!=[])]][2])
im not that good at golfing lol
Can you not just do iter(lambda:1,0)?
huh
!e ```py
{print(_)for _ in iter(lambda:1,0)}
@floral meteor :x: Your eval job timed out or ran out of memory.
001 | 1
002 | 1
003 | 1
004 | 1
005 | 1
006 | 1
007 | 1
008 | 1
009 | 1
010 | 1
011 | 1
... (truncated - too many lines)
Full output: too long to upload
like that?
Aye.
what about my password confirmer?
interesting
it loops while passwords do not match
how could i make an empty callable that returns None hm
It looks obfuscated.
other than a lambda
!e ```py
print([(_getpass:=lambda f:f),(_p:=[]),{(print("PASSWORDS DO NOT MATCH, YOU FOOL"),_p.pop(1),_p.pop(0))for _ in iter((lambda:[_p.append(_getpass('new password>')),_p.append(_getpass('confirm password>')),_p[~0]==_p[~1]][2]),True)},_p[~0]][3])
@floral meteor :x: Your eval job timed out or ran out of memory.
001 | PASSWORDS DO NOT MATCH, YOU FOOL
002 | PASSWORDS DO NOT MATCH, YOU FOOL
003 | PASSWORDS DO NOT MATCH, YOU FOOL
004 | PASSWORDS DO NOT MATCH, YOU FOOL
005 | PASSWORDS DO NOT MATCH, YOU FOOL
006 | PASSWORDS DO NOT MATCH, YOU FOOL
007 | PASSWORDS DO NOT MATCH, YOU FOOL
008 | PASSWORDS DO NOT MATCH, YOU FOOL
009 | PASSWORDS DO NOT MATCH, YOU FOOL
010 | PASSWORDS DO NOT MATCH, YOU FOOL
011 | PASSWORDS DO NOT MATCH, YOU FOOL
... (truncated - too many lines)
Full output: too long to upload
could i make lambda:1 any shorter?
lmao
is there like a built-in function i can use
!e ```py
print([(_getpass:=lambda f:"SUPER SECRET PASSWORD"),(_p:=[]),{(print("PASSWORDS DO NOT MATCH, YOU FOOL"),_p.pop(1),_p.pop(0))for _ in iter((lambda:[_p.append(_getpass('new password>')),_p.append(_getpass('confirm password>')),_p[~0]==_p[~1]][2]),True)},_p[~0]][3])
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
SUPER SECRET PASSWORD
that is less than 8 chars long
you see how it works?
just replace the lambda f:<password> with __import__('getpass').getpass because you can't input to the bot
!e {print(_)for _ in iter(set,0)}
@floral meteor :x: Your eval job timed out or ran out of memory.
001 | set()
002 | set()
003 | set()
004 | set()
005 | set()
006 | set()
007 | set()
008 | set()
009 | set()
010 | set()
011 | set()
... (truncated - too many lines)
Full output: too long to upload
lol
i would use id() to save one char but that takes an argument
!e print(id(1))
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
140681298794800
!e iter(1,0)
@floral meteor :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: iter(v, w): v must be callable
@floral meteor :x: Your eval job timed out or ran out of memory.
001 | 1
002 | 1
003 | 1
004 | 1
005 | 1
006 | 1
007 | 1
008 | 1
009 | 1
010 | 1
011 | 1
... (truncated - too many lines)
Full output: too long to upload
that requires that class tho
ye
plus doesnt save a char in the last line
!e ```py
i=type("",(),{'call':lambda s:1})()
{print(_)for _ in iter(i,0)}
@floral meteor :x: Your eval job timed out or ran out of memory.
001 | 1
002 | 1
003 | 1
004 | 1
005 | 1
006 | 1
007 | 1
008 | 1
009 | 1
010 | 1
011 | 1
... (truncated - too many lines)
Full output: too long to upload
!e ```py
with open("haha.py",'w')as file:file.write("import os")
print(import('os').system("set PYTHONSTARTUP=$cd/haha.py"))
@floral meteor :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | OSError: [Errno 30] Read-only file system: 'haha.py'
!e ```py
print(import('os').system("echo import os>haha.py & set PYTHONSTARTUP=$cd/haha.py"))
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
-1
@floral meteor :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 'os' is not defined
protected against shell injection
hey that reminds me...
once when I had a hobby in theatre, I figured out how to rename the microphone and named it fluffy but the techie then renamed it to no toucy so I renamed it to yestoucy
anyway...
LMAO
print(__import__('os').system("echo import os>haha.py & set PYTHONSTARTUP=$cd/haha.py"))
would eliminate the need to import os as it would already be imported, but only in the python shell, not in scripts
my bluetooth headphones ran out of battery
that's why i hate bluetooth headphones
How esoteric.
now I can't head-bop to intense music therefore I can't code...
You could try humming.
you see when it reaches 10%, it says low battery about 12 times before it actually runs out of battery
and it's louder than the music
and it has a chinese accent
Alas. I bet there's some way to execute shell commands in snekbox.
!e ```py
{print("Low Battery")for _ in range(12)}
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | Low Battery
002 | Low Battery
003 | Low Battery
004 | Low Battery
005 | Low Battery
006 | Low Battery
007 | Low Battery
008 | Low Battery
009 | Low Battery
010 | Low Battery
011 | Low Battery
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/ehozodifut.txt
why not list comp?
it is, but it's a set
Because order doesn't matter.
yea
so it eliminates duplicates
so it's memory efficient
and less memory writing, so slightly faster
!e print(*["Low Battery"]*12,sep='\n')
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | Low Battery
002 | Low Battery
003 | Low Battery
004 | Low Battery
005 | Low Battery
006 | Low Battery
007 | Low Battery
008 | Low Battery
009 | Low Battery
010 | Low Battery
011 | Low Battery
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/wawolojoha.txt
saves one extra character
saves the comma
!e ```py
print((12*"\nLow Battery")[1:])
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | Low Battery
002 | Low Battery
003 | Low Battery
004 | Low Battery
005 | Low Battery
006 | Low Battery
007 | Low Battery
008 | Low Battery
009 | Low Battery
010 | Low Battery
011 | Low Battery
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/kudabegoxi.txt
lol
THere, shorter
!e print((12*"\nLow Battery"))
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 |
002 | Low Battery
003 | Low Battery
004 | Low Battery
005 | Low Battery
006 | Low Battery
007 | Low Battery
008 | Low Battery
009 | Low Battery
010 | Low Battery
011 | Low Battery
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/faxazerozu.txt
oh
!e print(12*"Low Battery\n")
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | Low Battery
002 | Low Battery
003 | Low Battery
004 | Low Battery
005 | Low Battery
006 | Low Battery
007 | Low Battery
008 | Low Battery
009 | Low Battery
010 | Low Battery
011 | Low Battery
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/yecavokato.txt
huh
!e print('\n'.join(["Low Battery"]*12))
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | Low Battery
002 | Low Battery
003 | Low Battery
004 | Low Battery
005 | Low Battery
006 | Low Battery
007 | Low Battery
008 | Low Battery
009 | Low Battery
010 | Low Battery
011 | Low Battery
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/equyavifuh.txt
!e print('\n'.join(["Low Battery"]*999999))
@floral meteor :x: Your eval job timed out or ran out of memory.
001 | Low Battery
002 | Low Battery
003 | Low Battery
004 | Low Battery
005 | Low Battery
006 | Low Battery
007 | Low Battery
008 | Low Battery
009 | Low Battery
010 | Low Battery
011 | Low Battery
... (truncated - too many lines)
Full output: too long to upload
!e {print("Low Battery")for(_)in range(99999999999999999999999999)}
@floral meteor :x: Your eval job timed out or ran out of memory.
001 | Low Battery
002 | Low Battery
003 | Low Battery
004 | Low Battery
005 | Low Battery
006 | Low Battery
007 | Low Battery
008 | Low Battery
009 | Low Battery
010 | Low Battery
011 | Low Battery
... (truncated - too many lines)
Full output: too long to upload
huuuuuuuuuuuuuuuuuuuge number
!e ```py
print("Low Battery")
print("Low Battery")
print("Low Battery")
print("Low Battery")
print("Low Battery")
print("Low Battery")
print("Low Battery")
print("Low Battery")
print("Low Battery")
print("Low Battery")
print("Low Battery")
print("Low Battery")
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | Low Battery
002 | Low Battery
003 | Low Battery
004 | Low Battery
005 | Low Battery
006 | Low Battery
007 | Low Battery
008 | Low Battery
009 | Low Battery
010 | Low Battery
011 | Low Battery
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/xalaragigi.txt
@floral meteor :x: Your eval job has completed with return code 1.
001 | Low Battery
002 | Traceback (most recent call last):
003 | File "<string>", line 1, in <module>
004 | TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'
aw
!e print(12*"Low Battery\n")
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | Low Battery
002 | Low Battery
003 | Low Battery
004 | Low Battery
005 | Low Battery
006 | Low Battery
007 | Low Battery
008 | Low Battery
009 | Low Battery
010 | Low Battery
011 | Low Battery
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/farepizalo.txt
!e print(12*["Low Battery"])
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
['Low Battery', 'Low Battery', 'Low Battery', 'Low Battery', 'Low Battery', 'Low Battery', 'Low Battery', 'Low Battery', 'Low Battery', 'Low Battery', 'Low Battery', 'Low Battery']
!e print((12["Low Battery"]))
@sick hound :white_check_mark: Your eval job has completed with return code 0.
Low Battery Low Battery Low Battery Low Battery Low Battery Low Battery Low Battery Low Battery Low Battery Low Battery Low Battery Low Battery
I think we're back where we started
yea lol
without the print it would be 12*"Low Battery\n" but that would only work in REPL i guess
we need to bring back golfing challenges of the day
i would actually look forward to that
!e ```py
class h(str):xor=lambda s,n:'\n'.join([s]*n)
l=h("Low Battery")
print(l^12)
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | Low Battery
002 | Low Battery
003 | Low Battery
004 | Low Battery
005 | Low Battery
006 | Low Battery
007 | Low Battery
008 | Low Battery
009 | Low Battery
010 | Low Battery
011 | Low Battery
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/ipumikacos.txt
that works? hecc
making classes is cool but i think they count in the golf too
yeah
!e ```py
class twisted_int(int):xor,pow=lambda s,n:int.pow(s,n),lambda s,n:int.xor(s,n)
print(twisted_int(4)^2)
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
16
!e ```py
import random
class Maybe:
def bool(self):
return random.choice(True, False)
Maybe = Maybe()
if Maybe:
print("Maybe this will be printed.")
@sick hound :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 9, in <module>
003 | File "<string>", line 5, in __bool__
004 | TypeError: choice() takes 2 positional arguments but 3 were given
o
!e ```py
import random
class Maybe:
def bool(self):
return random.choice([True, False])
Maybe = Maybe()
if Maybe:
print("Maybe this will be printed.")
@sick hound :white_check_mark: Your eval job has completed with return code 0.
Maybe this will be printed.
!e ```py
import random
class Maybe:
def bool(self):
return random.choice([True, False])
Maybe = Maybe()
if Maybe:
print("Maybe this will be printed.")
@sick hound :warning: Your eval job has completed with return code 0.
[No output]
lol
i should probably inherit that off bool
!e ```py
import random
class Maybe:
def init(self):
self = random.choice((True, False))
Maybe = Maybe()
if Maybe:
print("Maybe this will be printed.")
@sick hound :white_check_mark: Your eval job has completed with return code 0.
Maybe this will be printed.
wait that actually works?
i didn't expect it to work
!e ```py
import random
class Maybe:
def new(cls):
return random.choice((True, False))
Maybe = Maybe()
if Maybe:
print("Maybe this will be printed.")
@sick hound :warning: Your eval job has completed with return code 0.
[No output]
this is probably better
!e ```py
class Maybe:bool=lambda s:import('random').choice([[]==[],[]!=[]])
[Maybe()and print("this might be printed")or print("[No output]") for _ in range(12)]
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | this might be printed
002 | [No output]
003 | this might be printed
004 | [No output]
005 | this might be printed
006 | [No output]
007 | [No output]
008 | [No output]
009 | this might be printed
010 | [No output]
011 | [No output]
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/wadeharoso.txt
haha
watch this
!e ```py
import random
Maybe = type("",(),{"new":random.choice((1,0))})()
if Maybe:
print("Maybe this will be printed.")
@sick hound :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 3, in <module>
003 | TypeError: 'int' object is not callable
o
sucks
!e ```py
import random
Maybe = type("",(),{"new":random.choice((1,0))})
if Maybe:
print("Maybe this will be printed.")
@sick hound :white_check_mark: Your eval job has completed with return code 0.
Maybe this will be printed.
lmao that's actually epic
you still gotta call it tho
it gave an error when i called it
idk why
!e ```py
Maybe = type("",(),{"new":import("random").choice([1,0])})
if Maybe:
print("Maybe this will be printed.")
@sick hound :white_check_mark: Your eval job has completed with return code 0.
Maybe this will be printed.
!e ```py
class Maybe:bool=call=lambda s:import('random').choice([[]==[],[]!=[]])
[Maybe()and print("this might be printed")for _ in range(24)]
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | this might be printed
002 | this might be printed
003 | this might be printed
004 | this might be printed
005 | this might be printed
006 | this might be printed
007 | this might be printed
008 | this might be printed
009 | this might be printed
010 | this might be printed
"might be printed"
10 lines for 24 iterations
huh
!e ```py
Maybe = type("",(),{"new":import("random").choice([1,0])})
for _ in range(10):
if Maybe:
print("Maybe this will be printed.")
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | Maybe this will be printed.
002 | Maybe this will be printed.
003 | Maybe this will be printed.
004 | Maybe this will be printed.
005 | Maybe this will be printed.
006 | Maybe this will be printed.
007 | Maybe this will be printed.
008 | Maybe this will be printed.
009 | Maybe this will be printed.
010 | Maybe this will be printed.
ay wtf
!e ```py
Maybe = type("",(),{"new":import("random").choice([1,0])})
for _ in range(100):
if Maybe:
print("Maybe this will be printed.")
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | Maybe this will be printed.
002 | Maybe this will be printed.
003 | Maybe this will be printed.
004 | Maybe this will be printed.
005 | Maybe this will be printed.
006 | Maybe this will be printed.
007 | Maybe this will be printed.
008 | Maybe this will be printed.
009 | Maybe this will be printed.
010 | Maybe this will be printed.
011 | Maybe this will be printed.
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/tucefaziqu.txt
why are there 100 lines :(
!e ```py
class Maybe:bool=call=lambda s:import('random').choice([[]==[],[]!=[]])
[Maybe()()and print("this might be printed")for _ in range(24)]
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | this might be printed
002 | this might be printed
003 | this might be printed
004 | this might be printed
005 | this might be printed
006 | this might be printed
007 | this might be printed
008 | this might be printed
009 | this might be printed
010 | this might be printed
011 | this might be printed
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/osimajivut.txt
code no worky
!e ```py
Maybe = type("",(),{"new":import("random").choice([1,0])})()
for _ in range(100):
if Maybe:
print("Maybe this will be printed.")
@sick hound :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: 'int' object is not callable
double call
how!
Maybe has the same value everytime
i never called it the first time
Maybe is a class
yeah
but it raises an error when i call it
damn python confusing
reject humanity go back to monke
!e bool(type)
@sick hound :warning: Your eval job has completed with return code 0.
[No output]
!e print(bool(type))
@sick hound :white_check_mark: Your eval job has completed with return code 0.
True
yea
makes sense
!e ```py
Maybe = type("",(),{"new":import("random").choice([1,0])})()
for _ in range(100):
if Maybe():
print("Maybe this will be printed.")
@sick hound :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: 'int' object is not callable
so confused
!e ```py
Maybe = type("",(),{"new":import("random").choice([1,0])})()
for _ in range(100):
print(Maybe)
@sick hound :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: 'int' object is not callable
you are calling
!e ```py
Maybe = type("",(),{"new":import("random").choice([1,0])})
for _ in range(100):
print(Maybe)
it in the first line
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | <class '__main__.'>
002 | <class '__main__.'>
003 | <class '__main__.'>
004 | <class '__main__.'>
005 | <class '__main__.'>
006 | <class '__main__.'>
007 | <class '__main__.'>
008 | <class '__main__.'>
009 | <class '__main__.'>
010 | <class '__main__.'>
011 | <class '__main__.'>
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/amufumagox.txt
!e
Maybe = type("",(),{"__new__":__import__("random").choice([1,0])})
for _ in range(100):
if Maybe():
print('hi')
@abstract widget :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: 'int' object is not callable
wtf
ik!!!
!e ```py
class Preposterous:call=lambda s:s;str=bool=import('random').choice([[]==[],[]!=[]])
print(Preposterous()()()()()()()()()()()()()()if Preposterous()()()()else Preposterous())
@floral meteor :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 2, in <module>
003 | TypeError: 'bool' object is not callable
oh
!e ```py
Maybe = type("",(),{"new":import("random").choice([1,0])})
for _ in range(100):
print(Maybe.new())
@sick hound :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: 'int' object is not callable
!e
Maybe = type("",(),{"__new__":__import__("random").choice([1,0])})
for _ in range(100):
if Maybe:
print('hi')
@abstract widget :white_check_mark: Your eval job has completed with return code 0.
001 | hi
002 | hi
003 | hi
004 | hi
005 | hi
006 | hi
007 | hi
008 | hi
009 | hi
010 | hi
011 | hi
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/jugexequno.txt
prints 100 times
hmm
@sick hound :white_check_mark: Your eval job has completed with return code 0.
True
omg chilaxan is the savior
You aren't setting new to a function
fuck
Your setting it to a number
!e ```py
Maybe = type("",(),{"new":lambda c:import("random").choice([1,0])})
for _ in range(100):
print(Maybe)
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | <class '__main__.'>
002 | <class '__main__.'>
003 | <class '__main__.'>
004 | <class '__main__.'>
005 | <class '__main__.'>
006 | <class '__main__.'>
007 | <class '__main__.'>
008 | <class '__main__.'>
009 | <class '__main__.'>
010 | <class '__main__.'>
011 | <class '__main__.'>
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/uvuguceluq.txt
!e ```py
Maybe = type("",(),{"new":lambda c:import("random").choice([1,0])})
for _ in range(100):
print(Maybe())
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | 0
002 | 0
003 | 0
004 | 0
005 | 0
006 | 0
007 | 1
008 | 1
009 | 1
010 | 0
011 | 0
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/edavusafel.txt
that's cool
If you make it bool instead of new then it'll only need one instance of Maybe
!e ```py
class Preposterous:call=lambda s:s;bool=lambda c:import("random").choice([True,False])
print(Preposterous()()()()()()()()()()()()()()()()()()()())
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
<__main__.Preposterous object at 0x7f06b88d7fd0>
!e
import random
class maybe:
def __new__(cls):
return random.choice(range(2))
for _ in range(100):
if maybe():
print('hi')
@abstract widget :white_check_mark: Your eval job has completed with return code 0.
001 | hi
002 | hi
003 | hi
004 | hi
005 | hi
006 | hi
007 | hi
008 | hi
009 | hi
010 | hi
011 | hi
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/wifiqibehi.txt
what abt all the other attributes of bool tho
['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__index__', '__init__', '__init_subclass__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'numerator', 'real', 'to_bytes']
want to keep this
!e
import random
class maybe:
def __bool__(self):
return random.choice(range(2))
maybe = maybe()
for _ in range(100):
if maybe:
print('hi')
@abstract widget :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 10, in <module>
003 | TypeError: __bool__ should return bool, returned int
!e
import random
class maybe:
def __bool__(self):
return bool(random.choice(range(2)))
maybe = maybe()
for _ in range(100):
if maybe:
print('hi')
@abstract widget :white_check_mark: Your eval job has completed with return code 0.
001 | hi
002 | hi
003 | hi
004 | hi
005 | hi
006 | hi
007 | hi
008 | hi
009 | hi
010 | hi
011 | hi
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/usegumiyum.txt
!e ```py
class Preposterous(bool):call=lambda s:s;bool=lambda c:import("random").choice([True,False]);str=lambda s:s and "True" or "False"
print([Preposterous()()()()()()()()()()()()()()()()()()()()for _ in range(24)])
@floral meteor :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: type 'bool' is not an acceptable base type
that's just not acceptable
!e ```py
Maybe = type("",(),{"new":lambda c:import("random").choice([1,0])})
for _ in iter(Maybe, 0):
print(_)
@sick hound :warning: Your eval job has completed with return code 0.
[No output]
!e ```py
Maybe = type("",(),{"new":lambda c:import("random").choice([1,0])})
for x in iter(Maybe, 1):
print(x)
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | 0
002 | 0
003 | 0
004 | 0
005 | 0
that's cool
!e ```py
Maybe = type("",(),{"new":lambda c:import("random").choice([1,0])})
[print(x) for x in [Maybe] * 100 if x]
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | <class '__main__.'>
002 | <class '__main__.'>
003 | <class '__main__.'>
004 | <class '__main__.'>
005 | <class '__main__.'>
006 | <class '__main__.'>
007 | <class '__main__.'>
008 | <class '__main__.'>
009 | <class '__main__.'>
010 | <class '__main__.'>
011 | <class '__main__.'>
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/ecilojovuf.txt
!e ```py
Maybe = type("",(),{"new":lambda c:import("random").choice([1,0])})
[print(x) for x in [Maybe()] * 100 if x]
@sick hound :warning: Your eval job has completed with return code 0.
[No output]
!e
maybe = type("",(),{"__bool__":lambda x: bool(__import__("random").choice([1,0]))})()
for i in range(100):
if maybe:
print(i)
@abstract widget :white_check_mark: Your eval job has completed with return code 0.
001 | 0
002 | 2
003 | 5
004 | 6
005 | 8
006 | 9
007 | 10
008 | 11
009 | 12
010 | 13
011 | 15
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/nowimiheto.txt
!e
maybe = type("",(),{"__bool__":lambda x: bool(__import__("random").choice(range(2)))})()
for i in range(100):
if maybe:
print(i)
@abstract widget :white_check_mark: Your eval job has completed with return code 0.
001 | 1
002 | 2
003 | 3
004 | 5
005 | 6
006 | 12
007 | 14
008 | 15
009 | 17
010 | 18
011 | 20
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/pihidufiwi.txt
Maybe = type("",(),{"__new__":lambda c:__import__("random").choice([1,0])})
how to make so it no use ()
no making object
or else it bad and no worky
going to look at more Maybe code
that what i'm about to do
!e ```py
class Marco:call=lambda _:print("Polo")or _;
Marco()()()()()()()()()()()()()()()()()()()()()()()()
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | Polo
002 | Polo
003 | Polo
004 | Polo
005 | Polo
006 | Polo
007 | Polo
008 | Polo
009 | Polo
010 | Polo
011 | Polo
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/wefahotite.txt
I'd call that esoteric
https://github.com/python-discord/esoteric-python-challenges/tree/master/challenges/06-maybe-keyword
!e
Test = type("",(),{"__call__":lambda s:s})
x = Test()()()()()()()()()()()()
print(x)
@sick hound :white_check_mark: Your eval job has completed with return code 0.
<__main__. object at 0x7f6b20a70fd0>
lmao thats actually cool
!e
x = type("",(),{"__call__":lambda s:s})()()()()()()()()()()()()
print(x)
@sick hound :white_check_mark: Your eval job has completed with return code 0.
<__main__. object at 0x7f4f5f9c7fd0>
lol you forgot a bit
hm?
type("",(),{"__call__":lambda s:print("Low Battery")or s})()()()()()()()()()()()()()()()()()()()()()()()()()
LOW BATTERY LMAO
!e type("",(),{"call":lambda s:print("Low Battery")or s})()()()()()()()()()()()()()()()()()()()()()()()()()
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | Low Battery
002 | Low Battery
003 | Low Battery
004 | Low Battery
005 | Low Battery
006 | Low Battery
007 | Low Battery
008 | Low Battery
009 | Low Battery
010 | Low Battery
011 | Low Battery
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/kavituqeja.txt
!e ```py
import random
class MaybeMeta(type):
def bool(self):
return random.choice((True, False))
class Maybe(metaclass = MaybeMeta):
...
@sick hound :warning: Your eval job has completed with return code 0.
[No output]
!e ```py
import random
class MaybeMeta(type):
def bool(self):
return random.choice((True, False))
class Maybe(metaclass = MaybeMeta):
...
for _ in range(50):
print(Maybe)
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | <class '__main__.Maybe'>
002 | <class '__main__.Maybe'>
003 | <class '__main__.Maybe'>
004 | <class '__main__.Maybe'>
005 | <class '__main__.Maybe'>
006 | <class '__main__.Maybe'>
007 | <class '__main__.Maybe'>
008 | <class '__main__.Maybe'>
009 | <class '__main__.Maybe'>
010 | <class '__main__.Maybe'>
011 | <class '__main__.Maybe'>
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/kikefonuku.txt
this is why I hate technology
!e type("",(),{"call":lambda s:print("Low Battery")or s})()()()()()()()()()()()()()()()()()()()()()()()()()
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | Low Battery
002 | Low Battery
003 | Low Battery
004 | Low Battery
005 | Low Battery
006 | Low Battery
007 | Low Battery
008 | Low Battery
009 | Low Battery
010 | Low Battery
011 | Low Battery
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/hacanohifu.txt
!e ```py
import random
class MaybeMeta(type):
def bool(self):
return random.choice((True, False))
class Maybe(metaclass = MaybeMeta):
...
for _ in range(50):
print(bool(Maybe))
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | True
002 | True
003 | True
004 | False
005 | False
006 | False
007 | False
008 | False
009 | False
010 | False
011 | False
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/xenayavomu.txt
try __str__=lambda s:str(bool(s))
@sick hound :warning: Your eval job has completed with return code 0.
[No output]
ahhh
that way you can string it to get its boolean value
Evil = (
lambda o:
setattr(o, '__iter__', lambda x:x)
or setattr(o, '__next__', lambda x:True)
or o
)(type("EvilIterator", (object,), {}))
!e ```py
import random
class MaybeMeta(type):
def bool(self):
return random.choice((True, False))
class Maybe(metaclass = MaybeMeta):
str = lambda s: str(bool(s))
repr = str
...
for _ in range(50):
print(bool(Maybe))
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | True
002 | True
003 | True
004 | True
005 | True
006 | False
007 | True
008 | False
009 | True
010 | True
011 | False
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/ipozerucop.txt
wouldn't i place that in the metaclass though?
yes
(_get_encrypted_token:=lambda:(_t:=(_getpass:=__import__('getpass').getpass)("copy and paste token here (ENTER to skip)>"))and((lambda source,key:(not key)and source or[len(source)<len(key)and(key:=key[:len(source)])or len(source)>len(key)and(key:=(key*(len(source)//len(key)+(()==())))[:len(source)]),(_s:=[ord(c)for(c)in list(source)]),(_k:=[ord(c)for(c)in list(key)]),(_p:=[]),[_p.append((((e-32)+(_k[i]-32))%95)+32)for i,e in enumerate(_s)],''.join([chr(n)for(n)in(_p)])][-1])(_t,[(_p:=[]),{(print("PASSWORDS DO NOT MATCH, YOU FOOL"),_p.pop(()==()),_p.pop(()!=()))for _ in iter((lambda:[_p.append(_getpass('new password>')),_p.append(_getpass('confirm password>')),_p[~([]!=[])]==_p[~([]==[])]][2]),True)},_p[~([]!=[])]][2]))or'')][[]!=[]]
!e ```py
import random
class MaybeMeta(type):
str = lambda s: str(bool(s))
repr = str
bool = random.choice([True, False])
class Maybe(metaclass = MaybeMeta):
...
for _ in range(50):
print(bool(Maybe))
@sick hound :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 12, in <module>
003 | TypeError: 'bool' object is not callable
!e ```py
import random
class MaybeMeta(type):
str = lambda s: str(bool(s))
repr = str
bool = random.choice([True, False])
class Maybe(metaclass = MaybeMeta):
...
for _ in range(50):
print(Maybe)
@sick hound :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 12, in <module>
003 | File "<string>", line 4, in <lambda>
004 | TypeError: 'bool' object is not callable
!e ```py
import random
class MaybeMeta(type):
str = lambda s: str(bool(s))
repr = str
bool = lambda s: random.choice([True, False])
class Maybe(metaclass = MaybeMeta):
...
for _ in range(50):
print(Maybe)
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | True
002 | False
003 | False
004 | False
005 | False
006 | True
007 | False
008 | False
009 | True
010 | False
011 | False
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/onizetazil.txt
@sick hound :warning: Your eval job has completed with return code 0.
[No output]
@sick hound :white_check_mark: Your eval job has completed with return code 0.
Ellipsis
oh
@sick hound :warning: Your eval job has completed with return code 0.
[No output]
wow
!e print(dir(...))
@sick hound :white_check_mark: Your eval job has completed with return code 0.
['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__']
<class 'ellipsis'>
!e ellipsis
@sick hound :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 'ellipsis' is not defined
!e ... < 5
@sick hound :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: '<' not supported between instances of 'ellipsis' and 'int'
!e help(dir)
@sick hound :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 'help' is not defined
!e object.new(type("",(),{}))
@sick hound :warning: Your eval job has completed with return code 0.
[No output]
!e print(object.new(type("",(),{"repr":lambda s:"e"})))
@sick hound :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | AttributeError: type object 'object' has no attribute 'new'
!e
wow = Ellipsis()
@abstract widget :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: 'ellipsis' object is not callable
!e
sad = Ellipsis
@abstract widget :warning: Your eval job has completed with return code 0.
[No output]
@sick hound :white_check_mark: Your eval job has completed with return code 0.
<class 'ellipsis'>
!e ```py
Ellipsis.class.new()
@sick hound :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: ellipsis.__new__(): not enough arguments
!e ```py
Ellipsis.class.new(Ellipsis)
@sick hound :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: ellipsis.__new__(X): X is not a type object (ellipsis)
!e ```py
Ellipsis.class.new(Ellipsis.class)
@sick hound :warning: Your eval job has completed with return code 0.
[No output]
!e ```py
print(Ellipsis.class.new(Ellipsis.class))
@sick hound :white_check_mark: Your eval job has completed with return code 0.
Ellipsis
r = [..., 1,2,3] == [Ellipsis, 1,2,3]
print(r)
yea
!e
r = [..., 1,2,3] == [Ellipsis, 1,2,3]
print(r)
wait so
why does Ellipsis exist as a literal, if ... works too
!e print(....class)
LMFAO
that's actually cool
python wtf
!e ```py
print((_get_encrypted_token:=lambda:(_t:=[(_getpass:=(lambda s:"Password1")),'yhjYwWbY&2a[cw^b\=PDmYx'][1])and((lambda source,key:(not key)and source or[len(source)<len(key)and(key:=key[:len(source)])or len(source)>len(key)and(key:=(key*(len(source)//len(key)+(()==())))[:len(source)]),(_s:=[ord(c)for(c)in list(source)]),(_k:=[ord(c)for(c)in list(key)]),(_p:=[]),[_p.append((((e-32)-(_k[i]-32))%95)+32)for i,e in enumerate(_s)],''.join([chr(n)for(n)in(_p)])][-1])(_t,[(_p:=[]),{(print("PASSWORDS DO NOT MATCH, YOU FOOL"),_p.pop(()==()),_p.pop(()!=()))for _ in iter((lambda:[_p.append(_getpass('new password>')),_p.append(_getpass('confirm password>')),_p[~([]!=[])]==_p[~([]==[])]][2]),True)},_p[~([]!=[])]][2]))or'')())
im gonna do something very cool with this new knowledge
... = type("",(),{"...":lambda s:s})
print(.......)
!e
... = type("",(),{"...":lambda s:s})
print(.......)
there
awwwww
cannot assign to Ellipsis
life ruined
!e
Ellipsis = type("",(),{"...":lambda s:s})
print(.......)
!e
Ellipsis = type("",(),{"...":lambda s:s})
print(Ellipsis.Ellipsis)
!e
Ellipsis = type("",(),{"...":lambda s:s})
print(Ellipsis....)
but look at this
!e
....__class__.__new__(....__class__).__class__.__new__(....__class__).__class__.__new__(....__class__)
@exotic venture :warning: Your eval job has completed with return code 0.
[No output]
how would I make try:except:else: a oneliner?
maybe something like ```py
with type("",(),{"enter":lambda self:1, "exit": lambda self, exception_type, exception_value, exception_traceback: exception_type==ZeroDivisionError and (print(1) or True)})():1/0
inline try-except @grave rover
the idea is to subclass ContextDecorator to call a context manager as an expression
hmm
context managers aren't really the solution since I'm trying to go for expressions rather than statements
what i linked is an expression
awesome, thanks
looks like something's going wrong with my obfuscator, hmm...
# Generated by Mart Obfuscator
a=[0]*14
a.__setitem__(0,[0]*9)
a.__setitem__(1,lambda b,*c,d=lambda c:c,e=Exception,**f:(g:={}).pop('r',type('',(__import__('contextlib').ContextDecorator,),{'__enter__':int,'__exit__':lambda h,*c:isinstance(c[1],e)and[g.update(r=d(c))]})()(b)(*c,**f)))
check=lambda j:(
a.__setitem__(2,j%3),
a.__setitem__(3,j-a[2]),
a[0][a[2]]==a[0][a[2]+3]==a[0][a[2]+6]and a[0][a[2]]or(
a[0][a[3]]==a[0][a[3]+1]==a[0][a[3]+1]and a[0][a[3]]or(
j&1and(a[0][1]==a[0][5]==a[0][9]and a[0][5]or(
a[0][3]==a[0][5]==a[0][7]and a[0][5]or 0))or 0))
)[-1]
board=lambda:(
a.__setitem__(4,'│'.join([' '*3]*3)),
a.__setitem__(5,'┼'.join(['─'*3]*3)),
a.__setitem__(6,lambda l:[l,'X','O'][a[0][l]]),
[(
print(a[4]),
print('│'.join([f'{a[6](m * 3):^3}',f'{a[6](m * 3 + 1):^3}',f'{a[6](m * 3 + 2):^3}'])),
print(a[4]),
m<2and print(a[5]))
for m in range(3)
])
main=lambda:(
a.__setitem__(7,0),
a.__setitem__(8,1),
a.__setitem__(9,0),
a.__setitem__(10,lambda:(a[7]<9and(not a[9]))and((
board(),
a.__setitem__(11,input(f'[Player {a[8]}] Position: ')),
a.__setitem__(13,lambda:(
-1,
a.__setitem__(12,int(a[11])),
0<=a[12]<=8and(
a[0][a[12]]and print('Spot already taken!')or(
a[0].__setitem__(a[12],a[8]),
a.__setitem__(9,check(a[12])),
a.__setitem__(7,a[7]+1),
a.__setitem__(8,3-a[8])))or
print('Invalid answer!'))),
a[1](a[13],lambda:print('Invalid answer!'),ValueError)),
a[10]())),
a[10](),
board(),
a[9]==0and print('Draw!')or print(f'Winner: Player {a[9]}')
)
__name__=='__main__' and(
print('Tic Tac Toe by Martmists'),
main()
)
this is supposed to be tic tac toe, but on input it doesn't seem to check/handle input, can't quite figure out why though
@grave rover
a[1](a[13],lambda:print('Invalid answer!'),ValueError))
``` calls
```py
lambda b,*c,d=lambda c:c,e=Exception,**f:(g:={}).pop('r',type('',(__import__('contextlib').ContextDecorator,),{'__enter__':int,'__exit__':lambda h,*c:isinstance(c[1],e)and[g.update(r=d(c))]})()(b)(*c,**f))
```, but the call should probably be
```py
a[1](a[13],d=lambda _:print('Invalid answer!'),e=ValueError))
@grave rover that exception catching function sends all positional and keyword args that are not directly for it into the func passed as the first arg
also while loops would prob be easier to implement with [*iter(func, flag)]
instead of recursion
@rugged sparrow :white_check_mark: Your eval job has completed with return code 0.
001 | [0]
002 | [0, 1]
003 | [0, 1, 2]
004 | [0, 1, 2, 3]
005 | [0, 1, 2, 3, 4]
006 | [0, 1, 2, 3, 4, 5]
007 | [0, 1, 2, 3, 4, 5, 6]
008 | [0, 1, 2, 3, 4, 5, 6, 7]
009 | [0, 1, 2, 3, 4, 5, 6, 7, 8]
010 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
thanks, that also helped me figure out a mistake in my obfuscator (kwargs)
it seems there's a few more issues to deal with though
!e ```py
_while = lambda f,c:[*iter(f,type('',(),{'eq':lambda *a:not c()})())]and None
x = []
_while(lambda:x.append(len(x))or print(x), lambda:len(x) < 10)```
@rugged sparrow :white_check_mark: Your eval job has completed with return code 0.
001 | [0]
002 | [0, 1]
003 | [0, 1, 2]
004 | [0, 1, 2, 3]
005 | [0, 1, 2, 3, 4]
006 | [0, 1, 2, 3, 4, 5]
007 | [0, 1, 2, 3, 4, 5, 6]
008 | [0, 1, 2, 3, 4, 5, 6, 7]
009 | [0, 1, 2, 3, 4, 5, 6, 7, 8]
010 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
!e
!eval [code]
Can also use: e
*Run Python code and get the results.
This command supports multiple lines of code, including code wrapped inside a formatted code
block. Code can be re-evaluated by editing the original message within 10 seconds and
clicking the reaction that subsequently appears.
We've done our best to make this sandboxed, but do let us know if you manage to find an
issue with it!*
!e ```py
import random
x = 10
final = []
while x > 0:
c = random.choice('a', 'b', 'c', 'd')
final.append(c)
print(f'{final[0]) {final[1]} {final[2]}')
@timid anchor :x: Your eval job has completed with return code 1.
001 | File "<string>", line 7
002 | print(f'{final[0]) {final[1]} {final[2]}')
003 | ^
004 | SyntaxError: f-string: unmatched ')'
mmmmmmmmmmmmmm
!e ```py
import random
x = 10
final = []
while x > 0:
c = random.choice('a', 'b', 'c', 'd')
final.append(c)
print(f"{final[0]) {final[1]} {final[2]}")
@timid anchor :x: Your eval job has completed with return code 1.
001 | File "<string>", line 7
002 | print(f"{final[0]) {final[1]} {final[2]}")
003 | ^
004 | SyntaxError: f-string: unmatched ')'
hm...
oh
!e ```py
import random
x = 10
final = []
while x > 0:
c = random.choice('a', 'b', 'c', 'd')
final.append(c)
print(f"{final[0]} {final[1]} {final[2]}")
@timid anchor :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 5, in <module>
003 | TypeError: choice() takes 2 positional arguments but 5 were given
this worked before...
weird...
!e ```py
import random
x = 10
final = []
while x > 0:
c = random.choice(['a', 'b', 'c', 'd'])
final.append(c)
print(f"{final[0]) {final[1]} {final[2]}")
@timid anchor :x: Your eval job has completed with return code 1.
001 | File "<string>", line 7
002 | print(f"{final[0]) {final[1]} {final[2]}")
003 | ^
004 | SyntaxError: f-string: unmatched ')'
Can anyone explain how exactly this works? What I want is it calls os.write() on two numbers, 256, and another really long one that starts with 8, but how does it work? Why does the long number turn into Hello, World!, ? How can I do this with other things?
And is there a Python 3 alternative for this, because os.write() doesn't work like that in Python3
256 could be the file handle for stdout, while the large number is the integer representation of "Hello, World!"
But why is the large number Hello, World!
Why is it that exact number, and how is this number formed? How did someone come up with this number and it means Hello World
How do I do this with other letters n things
hey guys im working on another inline code in py but im not sure how to get around this : ```py
@app.route('/')
def app_index():
return render_template('base.html', html='<h1>test</h1>')
app.route('/')(lambda: render_template('base.html', html='<h1>test</h1>'))
@f1(arg)
@f2
def func(): pass
# is equivalent to
def func(): pass
func = f1(arg)(f2(func))
i read up on how decorators work
what's the meaning of app.route('/')
its a flask thing
really
have you make program ?
what
finished it... it was surprisingly simple to make it
welp anyways heres my one line python flask/socketio live chatroom code:
oops it said its over 2k chars
heres the link to it if you wanna see https://repl.it/talk/share/live-chatroom-one-liner-1-line-seriesno5/116248
I am not 100% sure, but I think you take the hex repr of a string and convert it to an int. You should look up the py2 docs.
Hm, this isn't exactly related to python, but I was wondering if anyone knew about hacky modules in JavaScript. I just started learning it and was wondering if you could do weird stuff in it like you could in python using inspect, sys, etc.
You really can't. JS lives in the browser and as such is quite a bit more locked down.
Damn, that's unfortunate
@sick hound :white_check_mark: Your eval job has completed with return code 0.
What is esoteric python
!e
ARBITRARY_OBJECT = object()
class HorribleInt(int):
def __mod__(self, other):
return ARBITRARY_OBJECT
print(HorribleInt(8) % 2 == 0)
@fiery hare :white_check_mark: Your eval job has completed with return code 0.
False
@formal sandal yay!
yes, that's what I meant
:DDDDDDDDDDDDDDDD
Although no, this wouldn't pass the typechecker
because int.__mod__ returns an int
So this is enough:
class HorribleInt(int):
def __mod__(self, other):
return 42
why not 420?
not sure if this belongs here
''' import tkinter as tk
import datetime
class Countdown(tk.Frame):
def init(self, master):
super().init(master)
self.create_widgets()
self.seconds_left = 0
self._timer_on = False
def show_widgets(self):
self.label.pack()
self.entry.pack()
self.start.pack() ' ' '
def create_widgets(self):
self.label = tk.Label(self, text="00:00:00")
self.entry = tk.Entry(self, justify='center')
self.entry.focus_set()
self.start = tk.Button(self, text="Start",
command=self.start_button)
def countdown(self):
self.label['text'] = self.convert_seconds_left_to_time()
if self.seconds_left:
self.seconds_left -= 1
self._timer_on = self.after(1000, self.countdown)
else:
self._timer_on = False
def start_button(self):
# 1. to fetch the seconds
self.seconds_left = int(self.entry.get)
# 2. to prevent having multiple
self.stop_timer()
# Timers at once
self.countdown()
def stop_timer(self):
if self._timer_on:
self.after_cancel(self._timer_on)
self._timer_on = False
def convert_seconds_left_to_time(self):
return datetime.timedelta(seconds=self.seconds_left)
if name == 'main':
root = tk.Tk()
root.resizable(False, False)
countdown = Countdown(root)
countdown.pack()
root.mainloop()
the gui doesn't show when I run this timer
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
Help with that is probably better suited to other channels though.
This one is for intentionally using bad coding practice. Try one of the help channels.
#user-interfaces maybe?
True
I need help golfing this process, it looks long and messy
async def process_python_command(ctx):
try:r=("await "in(content:=ctx.content[len(ctx.content.split()[not....__hash__()])+....__eq__(...):]))and(r:=await eval(content.lstrip("await").strip()))or str(r:=eval(content)).startswith("<coroutine")and await r or r;return(r is not None or None)and((_:=r),str(r).startswith("<Message id=")and"exit code 0: Message Object"or str(r).startswith("<Channel id=")and"exit code 0: Channel Object"or str(r).startswith("<Guild id=")and"exit code 0: Guild object"or str(r).lstrip('[').startswith("<Message id=")and f"exit code 0: [Message Object{f's len={r.__len__()}'*(len(r)>(...==...))}]")
except SyntaxError:return"Exit code 1: INVALID SYNTAX YOU FOOL"
async def python(ctx):global msg;msg=[await ctx.send(this)for this in str(process_python_command(ctx))[0::2000]]
can't stop walrusing 😳
import os, random, playsound
a = []
for f in os.listdir(os.fsencode((_dir := "music/"))):
if (b := os.fsdecode(f)).endswith( (".mp3", ".wav") ): a.append(b)
c = lambda: os.system("cls")
while ((lambda y: (_ := playsound.playsound(f"{_dir}{(_ := ((lambda x: [x[(i := random.randrange(len(x)))], c(), print(x[i][:-4])])(a)))[0]}")))(0) != 0): None
async def process_system_command(m):
global msg
_=[" > B:\\Temp\\stdout.txt"*(">"not in(c:=m.content[len(m.content.split()[0])+1:]))]
_+=[(c.lower()=='time'and('<'not in c))*" < B:\\bin\\enter.txt"or " < B:\\bin\\yes.txt"*("<"not in c)]
_=(_[0]+_[1])*(not(m.content.startswith("cd")or m.content[1]==':'))
try:e=(d:=c.startswith('cd ')*c.lstrip('cd').lstrip()or(c[-1]==":")*(len(c)==2)*(c+'\\'))and[os.chdir(d or os.getcwd()),f"Exit code:{os.system(c+_)}"][1]
except Exception as r:e=f"Error: {r}";msg=[await m.channel.send(str(e)or "0")];return
n=(t:=__import__('time').time)();
while(_:='B:\\Temp\\stdout.txt'))in os.listdir()or(t()<n+500 or os.system("ERASE "+_)):
with open(_,'rb+')as s:r=s.read().decode()or await asyncio.sleep(1)
msg+=[await m.channel.send('`'*3+'nim\n'+_+'\n'+'`'*3)for _ in str(r)[0::1980]]
there how make golf?
You can change indentation to a single space per level.
Also shorten names, of course.
I'll just make a whole variable manager lol
And you don't need the inner brackets in send((...)...(...)) on the last line.
__call__ is a bit odd to use in golf
okay i've modified it, I'll now make a 'print version`
Hey @floral meteor!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
@floral meteor :x: Your eval job has completed with return code 1.
001 | File "<string>", line 18
002 | SyntaxError: 'await' outside async function
!e ```py
msg=[];P=print
class C:new=lambda c,:;await=lambda s:P("awaited",s.d)or s.d
class Os:
def init(s):s.s=True
system=lambda s,f:P('executing',f)and int(f=="NOT A COMMAND");chdir=lambda s,f:P('manipulating directory:',f);getcwd=lambda s:"B:\";listdir=lambda s:["B:\bin\stdout.txt"s._s]
def remove(s,d):P('manipulating file:',d);s._s=s._s(not d==s.listdir()[0])
class asyncio:sleep=lambda s,t:print('awaited waiting',t,'seconds');await=lambda s:s
class open:
def init(s,args,**kwargs):P("opening: ",args,kwargs);s.p=args[0];s.f=args[1]
def read(s,n=99):return("executed successfully"(s.f in["r","r+","a+"])or b'executed successfully'(s.f in["w+","rb","rb+","ab+","wb+"]))[:n]or None
def write(s,c):return len(c)(s.f[0]in['w','a']or s.f[-1]=='+')or None
close=lambda s:P("closed",s.p)
def psc(m):
global msg;os=Os()
_=[" > B:\Temp\stdout.txt"(">"not in(c:=m.content[len(m.content.split()[0])+1:])),(c.lower()=='time'and('<'not in c))" < B:\bin\enter.txt"or " < B:\bin\yes.txt"("<"not in c)]
=([0]+[1])(not(m.content.startswith("cd")or m.content[1]==':'))
try:e=(d:=c.startswith('cd ')c.lstrip('cd').lstrip()or(c[-1]==":")(len(c)==2)(c+'\'))and[os.chdir(d or os.getcwd()),f"Exit code:{os.system(c+)}"][1]
except Exception as r:e=f"Error: {r}";msg=[m.channel.send(str(e)or "0")];return
n=(t:=import('time').time)();
while(:='B:\Temp\stdout.txt')in os.listdir()or(t()<n+1 or os.remove()):s=open(,'rb+');r=s.read().decode()and os.remove()or asyncio.sleep(1,1);s.close()
msg+=[m.channel.send(''*3+'nim\n'+_+'\n'+''*3)for _ in str(r)[0::1980]]
class M:
def init(s,,c=None):s.content=;s.channel=c or type("ChannelType",(),{'send':(lambda s,f:P('awaited sending',f)or M(f,c))})
[psc(M())for _ in["echo 4","cd here","time < B:\bin\yes.txt","type B:\bin\enter.txt>enter.txt","NOT A COMMAND"]];print(*msg,sep='\n')
@floral meteor :x: Your eval job timed out or ran out of memory.
001 | opening: B:\Temp\stdout.txt rb+ {}
002 | manipulating file: B:\Temp\stdout.txt
003 | awaited waiting 1 seconds
004 | closed B:\Temp\stdout.txt
005 | opening: B:\Temp\stdout.txt rb+ {}
006 | manipulating file: B:\Temp\stdout.txt
007 | awaited waiting 1 seconds
008 | closed B:\Temp\stdout.txt
009 | opening: B:\Temp\stdout.txt rb+ {}
010 | manipulating file: B:\Temp\stdout.txt
011 | awaited waiting 1 seconds
... (truncated - too many lines)
Full output: too long to upload
guys can u please help me in writing a variable and name it something with the help of python bot?
can anyone plssss help me out!
This is esoteric python
lol
!e
from ctypes import c_void_p
class NoMore:
def __str__(self):
return "baby don't hurt me"
__repr__ = __str__
c_void_p.from_address(id(True)+8).value = id(NoMore)
what = love = object()
what is love
@timid imp :x: Your eval job has completed with return code 1.
001 | File "<string>", line 5
002 | __repr__ = __str__
003 | ^
004 | IndentationError: unindent does not match any outer indentation level
!e
from ctypes import c_void_p
class NoMore:
def __str__(self):
return "baby don't hurt me"
__repr__ = __str__
c_void_p.from_address(id(True)+8).value = id(NoMore)
what = love = object()
what is love
@timid imp :warning: Your eval job has completed with return code 0.
[No output]
!e
from ctypes import c_void_p
class NoMore:
def __str__(self):
return "baby don't hurt me"
__repr__ = __str__
c_void_p.from_address(id(True)+8).value = id(NoMore)
what = love = object()
print(what is love)
@timid imp :white_check_mark: Your eval job has completed with return code 0.
baby don't hurt me
!e
_while = lambda f,c:[*iter(f,type('',(),{'__eq__':lambda *a:not c()})())]and None
x = []
_while(lambda:x.append(len(x))or print(x), lambda:len(x) < 10)
@timid imp :white_check_mark: Your eval job has completed with return code 0.
001 | [0]
002 | [0, 1]
003 | [0, 1, 2]
004 | [0, 1, 2, 3]
005 | [0, 1, 2, 3, 4]
006 | [0, 1, 2, 3, 4, 5]
007 | [0, 1, 2, 3, 4, 5, 6]
008 | [0, 1, 2, 3, 4, 5, 6, 7]
009 | [0, 1, 2, 3, 4, 5, 6, 7, 8]
010 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Welcome to literal madness!
class _Operator:
def __init__(self, fn):
self.fn = fn
def __truediv__(self, arg):
return self.fn(arg)
def op(name, method_name):
class Op:
def __truediv__(self, _name):
if _name == name:
return _Operator(getattr(self, method_name))
else:
return super().__truediv__(_name)
Op.__name__ = Op.__qualname__ = f"op({name!r}, {method_name!r})"
return Op
class Maybe(op(">>", "shift"), op(">>=", "then"), op("<*>", "ap")):
def __init__(self, value):
self.value = value
def shift(self, other):
return self /">>="/ (lambda _: other)
def then(self, fn):
if self is Nothing:
return Nothing
else:
return fn(self.value)
def ap(self, arg):
if self is Nothing:
return Nothing
elif arg is Nothing:
return Nothing
else:
return Just(self.value(arg.value))
def __repr__(self):
if self is Nothing:
return "Nothing"
else:
return f"Just({self.value!r})"
Nothing = Maybe(object())
Just = Maybe
This is the most important line:
class Maybe(op(">>", "shift"), op(">>=", "then"), op("<*>", "ap")):
You inherit from classes that create "infix aliases" for methods
Associativity works out correctly
if you need a different one, I guess you could pick a different operator
!ban @formal sandal "bad"
class Functor(op("<$>", "fmap")):
def map(self, f):
raise NotImplementedError(self)
class Monad(Functor, op(">>=", "then"), op(">>", "shift")):
def pure(self, x):
raise NotImplementedError(self)
def then(self, f):
return self.map(f).join()
def join(self):
raise NotImplementedError(self)
def shift(self, other):
return self.then(lambda _: other)
class List(Monad):
def __init__(self, xs):
self.xs = xs
def pure(self, x):
return List([x])
def map(self, f):
return List([f(x) for x in self.xs])
def join(self):
rv = []
for x in self.xs:
rv.extend(x.xs)
return List(rv)
def __repr__(self):
return f"List({self.xs!r})"
also this (not really how it works in JS, but good enough)
!e
_=[]
try: print(_[420])
except IndexError as e: print(e[0])
@sudden willow :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 2, in <module>
003 | IndexError: list index out of range
004 |
005 | During handling of the above exception, another exception occurred:
006 |
007 | Traceback (most recent call last):
008 | File "<string>", line 3, in <module>
009 | TypeError: 'IndexError' object is not subscriptable
aww
wow
huh, neat
this is probably the first time I used multiple inheritance outside of Generic and Protocol
oh that's the first time I am seeing __qualname__ being used, i thought it was uselss
I've made a sort of pop the contents of a file thing
lambda n:(f:=open(n,'r')).read()and[f.seek(0),f.read(),f.close(),open(n,'w').close()][1]
how make smol?
Exactly, so from here, you'd expect an answer to a question like that to be something like:
"""
_=[]==[];__="%c";___={'_':_,'__':__}
And that's all the variables you'll need.
"""
I'm thinking this might be more suitable to here than the above channel:
switch={'input':{}}
async def input(p,m,f,*args,**k):
"""
:param p: prompt
:param m: message object
:param f: function to execute on input
:param args: args for f
:param k: kwargs
:return: message object
"""
global switch;msg=await m.channel.send(p)
switch['input'].update({'message':m,'target':f,'args':args,'kwargs':k})
return msg[0]
@client.event
async def on_message(message):
global msg,switch;msg=switch['input']and[message.channel,message.author]==[switch['input']['message'].channel,switch['input']['message'].author]and[await send(message.channel(switch['input']['f'](*switch['input']['args'],**switch['input']['k']))),switch.update({'input':{}})][0]or msg
if message.content.lower()=='echo':input("what to echo>",message,lambda s:s,message.content)
!e
string = "print('hello world')"
for i in range(15):
string = f"eval({ascii(string)})"
eval(string)
@snow beacon :white_check_mark: Your eval job has completed with return code 0.
hello world
!e
na = "'eval('')'"
nae = f"'eval({na})'"
ni = f"eval({nae})"
print(ni)
@sick hound :white_check_mark: Your eval job has completed with return code 0.
eval('eval('eval('')')')
!e
na = "'eval('print('Monke Think')')'"
nae = f"'eval({na})'"
ni = f"eval({nae})"
eval(ni)
@sick hound :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 4, in <module>
003 | File "<string>", line 1
004 | eval('eval('eval('print('Monke Think')')')')
005 | ^
006 | SyntaxError: invalid syntax
that has nothing to do with ascii?
In [1]: ascii("…")
Out[1]: "'\\u2026'"
It basically escapes any characters in a string.
!e
(
(
lambda __, ___, ____, _____: getattr(
__builtins__,
().__class__.__name__[__ << __]
+ ().__iter__().__class__.__name__[(__).__rmul__(-1)]
+ [].__class__.__name__[____ % ___]
+ chr(_____)
+ ().__class__.__name__[__ >> __],
)
)(
(lambda _: _).__code__.co_nlocals,
(lambda _, __: _ | __).__code__.co_nlocals,
(lambda _, __, ___: _ | __ | ___).__code__.co_nlocals,
(
(lambda _, __, ___: _ & __ & ___).__code__.co_nlocals.__rmul__(
(lambda _, __, ___: _ | __ | ___).__code__.co_nlocals
)
+ (True.__rmul__((lambda _, __: _ | __).__code__.co_nlocals))
).__rmul__(
(
lambda _, __, ___, ____, _____, ______, _______, ________, _________, __________:
_
).__code__.co_nlocals
),
)
)(
(
lambda __, ___, ____, _____, ______: hex.__class__.__name__[
___.__rmul__(____ * _____) - ______
].upper()
+ hex.__class__.__name__[___.__rmul__(____ * _____) - _____ - ______]
+ hex.__class__.__name__[___] * 2
+ hex.__class__.__name__[___.__rmul__(____ * _____)]
+ chr(__.__rmul__(___) + _____)
+ Warning.__qualname__[______ - True]
+ hex.__class__.__name__[___.__rmul__(____ * _____)]
+ Warning.__qualname__[_____]
+ ().__class__.__name__[___]
+ {}.__class__.__name__[______ - True]
+ chr(__.__rmul__(___) + ___)
)(
(
lambda _, __, ___, ____, _____, ______, _______, ________, _________, __________: (
_
)
).__code__.co_nlocals,
(lambda _, __, ___: _).__code__.co_nlocals,
(lambda _, __, ___, ____: _).__code__.co_nlocals,
(lambda _, __: _).__code__.co_nlocals,
(lambda _: _).__code__.co_nlocals,
)
)
@sick hound :white_check_mark: Your eval job has completed with return code 0.
Hello World!
You can use #bot-commands to test things out, by the way.
Oh, I thought it was the one I'd seen here a few times.
ascii is literally repr plus some extra escaping
As repr(), return a string containing a printable representation of an object, but escape the non-ASCII characters in the string returned by repr() using \x, \u or \U escapes. This generates a string similar to that returned by repr() in Python 2.
Probably not in this channel lol
Hi, how can I run a while 1: without reaching an overflow limit - I'm trying to run the code for more than a couple of days, but it always exits with an overflow error
No
Post request every while 1:
No assigning, only using a logger class outside of the while loop
what specific error do you get?
😄 It's a daily occurrence - I've restarted since, and it clears the log out when you reboot the service
consider that inside asyncio there is a while loop, and asyncio applications tend to run for months at a time.
so while loops are not the problem
What's likely to cause an overflow error
what is the actual name of the error?
ah
that one generally happens when you get too large a result to stuff into a float
This isn't nested inside a method or anything
I could wait it out and find the error message
And then come back
that would probably be best
that's as simple as I can make it
!e py print("string"["string"[-"string".__len__()].__len__()] == "string"[-"string".__len__() + "string"[-"string".__len__()].__len__()])
@dark loom :white_check_mark: Your eval job has completed with return code 0.
True
I don't know what I'm doing with my life
print("string".__bool__())?
that will output True
What was the goal?
@toxic jewel :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | AttributeError: 'str' object has no attribute '__bool__'
sad
!e
print(str.__bool__("string").__int__())```
@thin trout :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | AttributeError: type object 'str' has no attribute '__bool__'
Hello Anybody here?
I'd like to ask if python and javascript work in a similar way when it comes to garbage collection.
Python has the gc module. It is not exactly same as javascript, then.
The gc modules allows high-level Python code to change the behaviour of the garbage collector
From what I could gather, the garbage collectors of Javascript and Python behave roughly in the same way, removing objects that are not reachable (except what has been initialised at the start of the interpreter, maybe)
mind that gc only interfaces with the gc that handles reference cycles, ref counting and deletion from that will still occur
however, it seems that the javascript garbage collector/memory manager follows references, while the Python garbage collector goes after the memory manager, which manages the reference counting
one note of interest: JS garbage collector cannot be turned off, while the Python one can be (through the gc module)
python, in fact, has two separate garbage collectors
main one is reference-counting one, that destroys objects when their reference count reaches 0 ⇒ they are not referenced by anyone
problem with this is that it can not detect cyclic references (e.g. A → B and B → A), which leads to the issue that both A and B will not have their reference counts reach zero, meaning they can't be collected
to account for this problem, python has another garbage collecting technique
the one that is tracing references and looking for when nothing is referring to an object or collection of objects that reference each other only
and the latter garbage collection is the one you can turn off by calling gc.disable()
@elfin onyx let's see
!e
for _ in type("", (object,), {"__iter__": lambda self: self, "__next__": lambda self: "Arbitrary object!"})(): ...
@elfin onyx :warning: Your eval job timed out or ran out of memory.
[No output]
lol, @tribal moon made this
what
I was going to do that
how did you
oh
yeah I was going to make the class using a call to type
I think you can create a class another way as well, 🤔
how
idk
Lol
I'd feel bad for him
Is he in this discord?
probably, just anonymous
But i didn't know you could make an infite loop using itertools
I can neither confirm nor deny....
If so, look what you've done
that was cool
I was told he was in this server but he wanted to be anonymous
I meant that makes sense
it's more that he doesn't actually just have discord open at any given time
Imagine the amount of pings he would get
he only logs in if there's a reason he needs to, from what I understand
besides, we all know that lemon is just guido's beard alter ego.
!otn a guido's-bearded-alter-ego
Yeah it's too long
• an-object-is-an-instance-of-a-class
It doesn't flow off the tongue but
idk why but I'm really proud of that one
people love to throw around "oh yeah objects are an instance of a class"
that's a meaningless statement unless you already know what it means.
Tbh I like #ot1-perplexing-regexing s name rn
one day that channel is going to be named something you hate and it's going to look like you like that thing
Off-topic channels
There are three off-topic channels:
• #ot0-psvm’s-eternal-disapproval
• #ot1-perplexing-regexing
• #ot2-never-nester’s-nightmare
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
are you accusing us of going off-topic?
~~I made you reply to the wrong message,
~~
Lol
!e
from random import choice; import string; print(''.join(chr(ord((z := ' ' + string.ascii_lowercase + '.,')[z.index(i)-2]) - choice([0, 32])) for i in 'knnbujqyb.qwbyjqubqpbvqrke'))
@fiery hare :white_check_mark: Your eval job has completed with return code 0.
ILl sHOW YOu�wHOS on�TopIC
!e
from random import choice; import string; print(''.join(chr(ord((z := ' ' + string.ascii_lowercase + '.,')[z.index(i)-2]) - choice([0, 32])) for i in 'yjqbuckfbvjgtgbjcubvqbdgbcbtgcuqp'))
@fiery hare :white_check_mark: Your eval job has completed with return code 0.
wHo saID tHEre haS To�be�A�reasoN
I don't know how you understand that
lol
It looks the same to me
the string that it's decoding is different
yeah a while back I made a python code obfuscator
it's really bad though
but it looks horrible
they're not supposed to look good
Well, what, do you want it to look pretty or something?
It can expand a 10 or 15 line program into like 10000
it's horribly inefficient and I might try to make it better in the future
dunno if I will though
I could give an example of the code it generates if you want
All in favor for adding a esoteric folder in @night quarry react with 👍
Sure
make a one liner @night quarry