#esoteric-python
1 messages · Page 104 of 1
111-1-1<<1+1+1
!e ```py
import dis
dis.dis('(((((((True << (((([]==[]) << True) + True))) - True) << (True << True))) - True) << (True << True)) + True) << ((True << True) + True)')
@grave rover :white_check_mark: Your eval job has completed with return code 0.
001 | 1 0 LOAD_CONST 0 (True)
002 | 2 BUILD_LIST 0
003 | 4 BUILD_LIST 0
004 | 6 COMPARE_OP 2 (==)
005 | 8 LOAD_CONST 0 (True)
006 | 10 BINARY_LSHIFT
007 | 12 LOAD_CONST 0 (True)
008 | 14 BINARY_ADD
009 | 16 BINARY_LSHIFT
010 | 18 LOAD_CONST 0 (True)
011 | 20 BINARY_SUBTRACT
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/ehagiqekip.txt
tfw it doesn't optimize []==[] and similar
you can't do that with the stock REPL, as far as I know
even PYTHONSTARTUP is executed after it's output
cough use ipython cough
you can use code.InteractiveConsole to make an interactive console to make that string different for the current shell, but not everywhere
shell = code.InteractiveConsole()
shell.interact("Customized string here")```
why use vanilla repl when you can use a fancy repl with actual syntax highlighting and tab completion
I knew it
their question was how to change that string at the beginning of new repls
ipython is wonderful but the startup time hurts a little. still great, though
xd just keep it open the entire time
it's amortized constant lul
So apparently python 3.10 is adding pattern matching
There's gonna be a rennasiance of unreadable code
unreadable fast™️ code /s
Just seven more months...
I don't think pattern match fits very well with python because 1. there aren't any labels (switch case usually uses labels but rust has entirely different syntax for it "MatchArm"... this feels a little weird in python since everything looks like a label) 2. this is the first time a block will only be valid in another 3. you can assign to _ 4. https://brennan.io/2021/02/09/so-python/ ???? 🙃
!e
while G:
A+=1
if (I(D(A))/2).is_integer():
E=G
for F in range(0,I(D(A)),2):
B=D(A)[F:F+2];C=0
for H in D(A):
if H==B[1]:C+=1
if C>J(B[0]):break
if C!=J(B[0]):E=False
if E==G:print(A)```
@sick hound :x: Your eval job timed out or ran out of memory.
001 | 10
002 | 12
003 | 13
004 | 14
005 | 15
006 | 16
007 | 17
008 | 18
009 | 19
010 | 22
011 | 1012
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/acoqiqujac.txt
doesn't that not work
!e
for i in __import__("itertools").count(0):
for j in (k:=str(i)[::2]):
if k.count(j) != int(j): break
else: print(i)
?
!e
for i in __import__("itertools").count(0):
for l, j in enumerate((k:=str(i)[::2])):
if k.count(j) != int(k[l+1]): break
else: print(i)
@sick hound :x: Your eval job timed out or ran out of memory.
001 | 1
002 | 10
003 | 11
004 | 12
005 | 13
006 | 14
007 | 15
008 | 16
009 | 17
010 | 18
011 | 19
... (truncated - too many lines)
Full output: too long to upload
op
!e
for i in __import__("itertools").count(0):
if len(str(i)) % 2 != 1: continue
for l, j in enumerate((k:=str(i)[::2])):
if k.count(j) != int(k[l+1]): break
else: print(i)
!e
for i in __import__("itertools").count(0):
if len(str(i)) % 2 != 0: continue
for l, j in enumerate((k:=str(i)[::2])):
if k.count(j) != int(str(i)[l*2+1]): break
else: print(i)
er,
??
wait oh
@sick hound :x: Your eval job timed out or ran out of memory.
001 | 11
002 | 21
003 | 31
004 | 41
005 | 51
006 | 61
007 | 71
008 | 81
009 | 91
010 | 1101
011 | 1121
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/agewuyawoj.txt
huh
gonna need to work w/ pycharm
!e
J=int;I=len;G=True;D=str;A=0
while G:
A+=1
if (I(D(A))/2).is_integer():
E=G
for F in range(0,I(D(A)),2):
B=D(A)[F:F+2];C=0
for H in D(A):
if H==B[1]:C+=1
if C>J(B[0]):break
if C!=J(B[0]):E=False
if E==G:print(A)```
where should i ask for help in regex?
@sick hound :x: Your eval job timed out or ran out of memory.
001 | 10
002 | 12
003 | 13
004 | 14
005 | 15
006 | 16
007 | 17
008 | 18
009 | 19
010 | 22
011 | 1012
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/uxakomuciv.txt
oh lol
@runic ruin code doesn't seem to work
wait
no
i'm just small brain
for num in __import__("itertools").count(0):
if len(str(num)) % 2 == 1: continue
for i, j in enumerate(str(num)[1::2]):
if int(str(num)[i * 2]) != str(num).count(j): break
else: print(num)```
behold a 5 liner
@runic ruin
or if importy is cheaty
a = 0
while (a:=a+1):
!e py for num in __import__("itertools").count(0): if len(str(num)) % 2 == 1: continue for i, j in enumerate(str(num)[1::2]): if int(str(num)[i * 2]) != str(num).count(j): break else: print(num)
@runic ruin :x: Your eval job timed out or ran out of memory.
001 | 10
002 | 12
003 | 13
004 | 14
005 | 15
006 | 16
007 | 17
008 | 18
009 | 19
010 | 22
011 | 1012
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/ecidakinay.txt
@sick hound how the heck...
B=str
for A in __import__('itertools').count(0):
if len(B(A))%2==1:continue
for (C,D) in enumerate(B(A)[1::2]):
if int(B(A)[C*2])!=B(A).count(D):break
else:print(A)
?
v = 0
while(v:=v+1):
if len(n:=str(v))%2:continue
for i,j in enumerate(n[1::2]):
if int(n[i*2])!=n.count(j):break
else:print(v)```
here's no importing
for v in __import__("itertools").count(0):
if len(n:=str(v))%2:continue
for i,j in enumerate(n[1::2]):
if int(n[i*2])!=n.count(j):break
else:print(v)```
this is importing
@runic ruin
sorry my internet gave out
yep
but which one is faster?
¯_(ツ)_/¯
idek how count works
probably the first one, as you don't have to call a generator
but they're really close
you could technically shorten it more by removing the if:break, but then it would be ever so slightly slower
no it needs it
cause python's break sets a flag that I don't have to define
which i can read with else
*I meant on the original code
yeah
its not needed, and wouldn't make much of a difference
@sick hound this happened
Which py ver?
3.7
Only works on 3.8+
walrus operator is python 3.8 +
at least this one works
while(v:=globals().get('v', -1) + 1):
if len(n:=str(v))%2:continue
for i,j in enumerate(n[1::2]):
if int(n[i*2])!=n.count(j):break
else:print(v)
Cursed
one less line ¯_(ツ)_/¯
I've started a war
what's the goal here
the largest I could find was 98989898989898989876767676767676545454545432323210
so we may be here a while
I ran my code and it stopped at 666666
dang
I still don't understand what "numbers that describe itself" means
In mathematics, a self-descriptive number is an integer m that in a given base b is b digits long in which each digit d at position n (the most significant digit being at position 0 and the least significant at position b−1) counts how many instances of digit n are in m.
aka
abcd
there are a b's
and c d's
in the num
that seems to be a common issue
according to that page there should always be a zero inside the number
989898989898989898979797979797979797969696969696969696959595959595959595949494949494949494939393939393939393929292929292929292919191919191919191909090909090909090
Everyone happy?
it describes itself
assuming num abcd, there are a b's in the number and c d's
nine eights (x9) nine sevens (x9) nine sixes (x9) nine fives (x9) nine fours (x9) nine threes (x9) nine twos (x9) nine ones (x9) nine zeros (x9)
Aka 14233221 1 4, 2 3s, etc
so not 4 2s?
mine follows that rule
No
apparently this has 162 digits
so beat that
wifi went out
wack
I'll pay you $100 to find a number larger than that that describes itself
gonna need to get a gcc compiler and rewrite
but i don't have cpp
fuck
visual studio aint co-operating
Some things to speed up your code:
All numbers that describe themselves...
...have an even number of digits
...will never have a "pair" starting in 0
ok I got it to 4 lines
show code
while((v:=globals().get('v',-1)+1)+1):
for i,j in enumerate((n:=str(v))[1::2]):
if int(n[i*2])!=n.count(j) or len(str(v))%2:break
else:print(v)
I added 1 because 0 is falsy
That looks suspiciously esoteric
(lambda x: __import__("sys").stdout.write(x.__add__(__debug__).__str__()))(__debug__)
forgot to evaluate ah
!e
(lambda x: __import__("sys").stdout.write(x.__add__(__debug__).__str__()))(__debug__)
@toxic jewel :white_check_mark: Your eval job has completed with return code 0.
2
finally figured out how to do lambdas without assigning them to a variable
!e
while (i:=globals().get('i',+1)+1):[bool(print(i)) if all([True if not (int(x) % 2) else False for x in str(i)]) else False]+[quit() if i>100 else False]
@drifting grove :x: Your eval job has completed with return code 1.
001 | 2
002 | 4
003 | 6
004 | 8
005 | 20
006 | 22
007 | 24
008 | 26
009 | 28
010 | 40
011 | 42
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/iroliguxaq.txt
@toxic jewel :white_check_mark: Your eval job has completed with return code 0.
['__repr__', '__hash__', '__getattribute__', '__lt__', '__le__', '__eq__', '__ne__', '__gt__', '__ge__', '__iter__', '__init__', '__or__', '__ror__', '__ior__', '__len__', '__getitem__', '__setitem__', '__delitem__', '__contains__', '__new__', '__sizeof__', 'get', 'setdefault', 'pop', 'popitem', 'keys', 'items', 'values', 'update', 'fromkeys', 'clear', 'copy', '__reversed__', '__class_getitem__', '__doc__', '__str__', '__setattr__', '__delattr__', '__reduce_ex__', '__reduce__', '__subclasshook__', '__init_subclass__', '__format__', '__dir__', '__class__']
was not aware that was a thing
Huh
globals()
@slim stratus Why #esoteric-python? Or do you want the most intentionally horrible solution to this?
Ok
One bad solution coming right up
Unless I get stuck and give up
Have you read the channel description?
you might want to ask for help in a general help channel
you are on the Python Discord server
all channels deal mostly with Python
!e
x='''
{
"3": {
"username": "Pazo",
"look": "sh-906-92.fa-3378-92-92.ch-255-110.hr-831-34.he-3082-92.hd-180-1359.lg-3116-1198-92.ha-3144-96-1428",
"motto": "pazo@hubba.to",
"rank": "12",
"rank_desc": "Hotelmanager"
},
"6292": {
"username": "Wassereis",
"look": "hd-605-2.ch-660-1198.he-3146-92.hr-3012-1403.lg-3057-1422.ca-3414-63",
"motto": "cat goes meow meow",
"rank": "5",
"rank_desc": "Moderator"
}
}'''
y=[__import__("json").loads(x)[z]["username"]for z in (__import__("json").loads(x))]
print (y)
@drifting grove :white_check_mark: Your eval job has completed with return code 0.
['Pazo', 'Wassereis']
Worst solution I can think of
that's a bit too standard
Yeah
I'm on mobile rn so I can't type too much but maybe one of you have some improvements for it
!e
x='''
{
"3": {
"username": "Pazo",
"look": "sh-906-92.fa-3378-92-92.ch-255-110.hr-831-34.he-3082-92.hd-180-1359.lg-3116-1198-92.ha-3144-96-1428",
"motto": "pazo@hubba.to",
"rank": "12",
"rank_desc": "Hotelmanager"
},
"6292": {
"username": "Wassereis",
"look": "hd-605-2.ch-660-1198.he-3146-92.hr-3012-1403.lg-3057-1422.ca-3414-63",
"motto": "cat goes meow meow",
"rank": "5",
"rank_desc": "Moderator"
}
}'''
y=[__import__("json").loads(x).get(str(z))["username"]for z in range(0,100000) if __import__("json").loads(x).get(str(z)) is not None ]
print (y)
@hard spoke :white_check_mark: Your eval job has completed with return code 0.
['Pazo', 'Wassereis']
still seems a bit too efficient
the ids seem to be numeric and small, so you can just iterate over them all
yeah, hmm
ah, I know
!e
x='''
{
"3": {
"username": "Pazo",
"look": "sh-906-92.fa-3378-92-92.ch-255-110.hr-831-34.he-3082-92.hd-180-1359.lg-3116-1198-92.ha-3144-96-1428",
"motto": "pazo@hubba.to",
"rank": "12",
"rank_desc": "Hotelmanager"
},
"6292": {
"username": "Wassereis",
"look": "hd-605-2.ch-660-1198.he-3146-92.hr-3012-1403.lg-3057-1422.ca-3414-63",
"motto": "cat goes meow meow",
"rank": "5",
"rank_desc": "Moderator"
}
}'''
y={__import__("json").loads(x).get(str(z))["username"] for z in (__import__("random").randint(0,100000) for i in range(0,1000000)) if __import__("json").loads(x).get(str(z)) is not None}
print (list(y))
@hard spoke :warning: Your eval job timed out or ran out of memory.
[No output]
nice!
It's beautiful
!e
x='''
{
"3": {
"username": "Pazo",
"look": "sh-906-92.fa-3378-92-92.ch-255-110.hr-831-34.he-3082-92.hd-180-1359.lg-3116-1198-92.ha-3144-96-1428",
"motto": "pazo@hubba.to",
"rank": "12",
"rank_desc": "Hotelmanager"
},
"6292": {
"username": "Wassereis",
"look": "hd-605-2.ch-660-1198.he-3146-92.hr-3012-1403.lg-3057-1422.ca-3414-63",
"motto": "cat goes meow meow",
"rank": "5",
"rank_desc": "Moderator"
}
}'''
y=[__import__("json").loads(x).get(str(z))["username"] for z in {__import__("random").randint(0,100000) for i in range(0,1000000)} if __import__("json").loads(x).get(str(z)) is not None]
print(y)
@hard spoke :white_check_mark: Your eval job has completed with return code 0.
['Pazo', 'Wassereis']
weird, why did the previous one not work?..
you use a set now
well, I think that the only obvious way to do worse now is to parse the json manually
@slim stratus :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | ModuleNotFoundError: No module named 'requests'
__import__ is uglier
because we're trying to give you the worst code possible
if you'd asked in a help channel, you might have had an understandable solution. Here? you get code hell 😄
json isn't a big enough topic to give its own channel. you should use the help channels, check out #❓|how-to-get-help
this is not the ideal channel for help
@toxic jewel :warning: Your eval job has completed with return code 0.
[No output]
nice
!e
call=lambda a,b,*args:getattr(__import__(a),b)(*args)
print(call("math","trunc",1.2))
@hard spoke :white_check_mark: Your eval job has completed with return code 0.
1
!e ```py
call=lambda a,b,*args,**kwargs:getattr(import(a),b)(*args,**kwargs)
print(call("math","trunc",1.2))
@naive roost :white_check_mark: Your eval job has completed with return code 0.
1
@toxic jewel :white_check_mark: Your eval job has completed with return code 0.
1
??
!e
((__import__("sys").stdout.write(chr(__:=[(lambda x:(x.__add__(__name__.__len__().__bool__().__int__())))(x) for x in range(ord(chr(72)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[(lambda x:(x.__add__(__name__.__len__().__bool__().__int__())))(x) for x in range(ord(chr(101)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[(lambda x:(x.__add__(__name__.__len__().__bool__().__int__())))(x) for x in range(ord(chr(108)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[(lambda x:(x.__add__(__name__.__len__().__bool__().__int__())))(x) for x in range(ord(chr(108)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[(lambda x:(x.__add__(__name__.__len__().__bool__().__int__())))(x) for x in range(ord(chr(111)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[(lambda x:(x.__add__(__name__.__len__().__bool__().__int__())))(x) for x in range(ord(chr(44)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[(lambda x:(x.__add__(__name__.__len__().__bool__().__int__())))(x) for x in range(ord(chr(32)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[(lambda x:(x.__add__(__name__.__len__().__bool__().__int__())))(x) for x in range(ord(chr(87)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[(lambda x:(x.__add__(__name__.__len__().__bool__().__int__())))(x) for x in range(ord(chr(111)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[(lambda x:(x.__add__(__name__.__len__().__bool__().__int__())))(x) for x in range(ord(chr(114)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[(lambda x:(x.__add__(__name__.__len__().__bool__().__int__())))(x) for x in range(ord(chr(108)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[(lambda x:(x.__add__(__name__.__len__().__bool__().__int__())))(x) for x in range(ord(chr(100)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[(lambda x:(x.__add__(__name__.__len__().__bool__().__int__())))(x) for x in range(ord(chr(33)).__int__())][-(__debug__.__int__())]))))))))))))))))```
@toxic jewel :white_check_mark: Your eval job has completed with return code 0.
Hello, World!
a=[-6,-3,-2,-1,0,1,3,4,5,7,8,9,10,11,14,15,17,18,19,20,None]
c,d,n=1,0,[]
for i in a[:-1]:
d+=1
if i+1==a[d]:c+=1
else:
if c>2:n+=f'{i-c+1}-{i}',
else:
q=[]
for e in range(c):q+=f'{i-e}',
n+=q[::-1]
c=1
print(','.join(n))
any thoughts on shortening this?
i think i did the most possible, but im not sure if there's anything else?
any input would be greatly appreciated
are you golfing?
⛳
@toxic jewel yes
here's the context:
individual integers
or a range of integers denoted by the starting integer separated from the end integer in the range by a dash, '-'. The range includes all integers in the interval including both endpoints. It is not considered a range unless it spans at least 3 numbers. For example "12,13,15-17"
Complete the solution so that it takes a list of integers in increasing order and returns a correctly formatted string in the range format.
Example:
solution([-6, -3, -2, -1, 0, 1, 3, 4, 5, 7, 8, 9, 10, 11, 14, 15, 17, 18, 19, 20])
# returns "-6,-3-1,3-5,7-11,14,15,17-20"```
id reccomend using list comprehensions and (...)if condition else(...)
sorry, im not familiar with those, do you have any resources for that? @toxic jewel
for the other one:
instead of
condition = True
if condition: ...
else: ...
you can use
condition = True
(... if condition else ...)
@toxic jewel will definitely check those out. thank you!
are you counting chars or bytes?
chars i believe?
thanks!
exec("㵡ⵛⰶ㌭ⰲㄭ〬ㄬ㌬㐬㔬㜬㠬㤬ㄬⰰㄱㄬⰴ㔱ㄬⰷ㠱ㄬⰹ〲丬湯嵥挊搬測ㄽ〬嬬潦湩愠㩛ㄭ㩝 ⭤ㄽ 晩椠ㄫ㴽孡嵤挺㴫‱ 汥敳†晩挠㈾渺㴫❦楻挭ㄫ楻❽ਬ†汥敳†焠嬽†映牯攠椠慲杮⡥⥣焺㴫❦楻攭❽ਬ†渠㴫孱㨺ㄭ†㵣牰湩⡴Ⱗ⸧潪湩渨⤩".encode("u16")[2:])
🙃
whoa
lots more bytes, but lots fewer chars
depends what you're going for
and for reference I did ```py
print("""<insert code here>""".encode("u8").decode("u16"))
to get the special stuff
lmaoo that's amazing, thanks! very interesting, didnt even kwow about that
👍
if you are indeed counting chars it's a 94 char saving
and given it was originally 240 that's a lot
x = 0
while x + 1 > x:
x += 1
print(x)
how long will this take?
It'll run forever right? Since python has arbitrary precision arithmetic?
I'm not sure but once the integer exceeds the machine word size I think it switches to a different representation
I guess eventually you'll hit some kind of limit but you won't reach that print(x)
Floating point numbers do have a limit, but integers dont
python floats conform to ieeeeeeeeeeeeeeeeee754 doubles
!e ```py
print(import("sys").float_info
Oops
!e ```py
print(import("sys").float_info)
@frozen holly :white_check_mark: Your eval job has completed with return code 0.
sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1)
nice
Max is real big omg
!e
print(import("sys").int_info)
@rustic aspen :white_check_mark: Your eval job has completed with return code 0.
sys.int_info(bits_per_digit=30, sizeof_digit=4)
too lazy
im just going to assume from now on that python can store ints infinitely large
it can
technically not
theoretically
but practically yeah
!e
print(2**100)
@twilit grotto :white_check_mark: Your eval job has completed with return code 0.
1267650600228229401496703205376
nice
@rustic aspen :white_check_mark: Your eval job has completed with return code 0.
7270764247501992104640575426377036972876299645019310024924408647831052430449489473041861968435253505203716131370917392635349098527590031784285597289260323814555927234600202442196927986295710056957987838594801067981591652503176474554717039082148825209165504975568061380183760539388834079862400899597228363456885132158640742191417432496216530812785352371895877220299694581946039309165929616792614101159858891783318528312934440580697497709335517072451859635440799975739766809564223690984481779367495084944757931663226881260435233938168877023095760861204449014664944414145909331878732571492915937097848938945614598761899737932918352327967299282002944635755098819421999167155787613345618898731202555744373423729418759433057190669011041587225114127431421213848107427543740765079735041745824936061127608422590014052738382245825052372721865009035952624167346995134874653625486284847125561281606499752114242594787676082149939880652561537978726798505832992439908511557999940996653156876241170531591264409504503
... (truncated - too long)
Full output: too long to upload
nice
Yeah probably
recursively convert code into something of the form exec(chr(a)+chr(b)+chr(c)+...)
infinite size
parser stack overflow after N iterations
@analog shadow :white_check_mark: Your eval job has completed with return code 0.
Hello world!
!e from future import braces
@analog shadow :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | SyntaxError: not a chance
!e import this
@analog shadow :white_check_mark: Your eval job has completed with return code 0.
001 | The Zen of Python, by Tim Peters
002 |
003 | Beautiful is better than ugly.
004 | Explicit is better than implicit.
005 | Simple is better than complex.
006 | Complex is better than complicated.
007 | Flat is better than nested.
008 | Sparse is better than dense.
009 | Readability counts.
010 | Special cases aren't special enough to break the rules.
011 | Although practicality beats purity.
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/catolovone.txt
import antigravity is also kinda nice
!e import antigravity
@rugged sparrow :warning: Your eval job has completed with return code 0.
[No output]
It attempts to open a browser to a comic
!e import antigravity;print(dir(antigravity))
@analog shadow :white_check_mark: Your eval job has completed with return code 0.
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'geohash', 'hashlib', 'webbrowser']
!e import antigravity;print(antigravity.hashlib(antigravity.geohash))
@analog shadow :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: 'module' object is not callable
And apparently geohash is a function someone made as a reference to a different XKCD comic
Interesting standard name lol
>>> from __future__ import barry_as_FLUFL
>>> 0!= 1
File "<stdin>", line 1
0!= 1
^
SyntaxError: with Barry as BDFL, use '<>' instead of '!='
>>> 0 <> 1
True
>>> 1 <> 1
False```'
You don't have to work hard -- just use inheritance as much as you can 🙂
and connect the classes in an extremely confusing way, with metaclasses accessing MongoDB to perform dependency injection or something like that
Yes
Proof: any of my projects lol
how would you obfuscate py code?
Could you use a crypter or do you have to use other methods?
There's a lot of different methods
!e py exec("㵡ⵛⰶ㌭ⰲㄭ〬ㄬ㌬㐬㔬㜬㠬㤬ㄬⰰㄱㄬⰴ㔱ㄬⰷ㠱ㄬⰹ〲丬湯嵥挊搬測ㄽ〬嬬潦湩愠㩛ㄭ㩝 ⭤ㄽ 晩椠ㄫ㴽孡嵤挺㴫‱ 汥敳†晩挠㈾渺㴫❦楻挭ㄫ楻❽ਬ†汥敳†焠嬽†映牯攠椠慲杮⡥⥣焺㴫❦楻攭❽ਬ†渠㴫孱㨺ㄭ†㵣牰湩⡴Ⱗ⸧潪湩渨⤩".encode("u16")[2:])
@last locust :white_check_mark: Your eval job has completed with return code 0.
-6,-3-1,3-5,7-11,14,15,17-20
That's one example
ah
!e py print(().__class__.__name__.__str__()[::-(().__class__.__name__.__str__().__len__().__sub__([1].__len__().__bool__().__str__().__len__()).__sub__(().__class__.__name__.__str__().__len__().__sub__(().__class__.__name__.__str__().__len__().__sub__([1].__len__().__bool__().__str__().__len__()).__sub__(().__class__.__name__.__str__().__len__().__sub__([1].__len__().__bool__().__str__().__len__()).__sub__(().__class__.__name__.__str__().__len__().__sub__([1].__len__().__bool__().__str__().__len__()).__sub__(().__class__.__name__.__str__().__len__().__sub__([1].__len__().__bool__().__str__().__len__()).__sub__(().__class__.__name__.__str__().__len__().__sub__([1].__len__().__bool__().__str__().__len__()).__sub__(().__class__.__name__.__str__().__len__().__sub__([1].__len__().__bool__().__str__().__len__()).__sub__(().__class__.__name__.__str__().__len__().__sub__([1].__len__().__bool__().__str__().__len__()))))))))))])also stacking dunders
@last locust :white_check_mark: Your eval job has completed with return code 0.
tl
Seems beyond me tbh
Does the python bot have measures in place for preventing people from executing malicious scripts
!e py print([globals().__setitem__('_', ~-~-(-~-~-~-~int()).__pow__(-~-~int()).__sub__((-~-~int()).__pow__(-~-~int()))), '\n'.join(map(str, map(__import__('\x72\x61\x6e\x64\x6f\x6d').choice, [[x for x in map(str, range(-~int(), -~(_).__pow__(-~-~int())))] for __ in range(_)])))][~-int()])
@last locust :white_check_mark: Your eval job has completed with return code 0.
001 | 62
002 | 20
003 | 13
004 | 10
005 | 23
006 | 6
007 | 79
008 | 2
009 | 40
010 | 75
That's one I did for generating 10 random numbers 1-100
When it's broken down it's pretty simple
But just from looking at it it's really ugly and "obfuscated"
fair enough i suppose i ll look more into this. Thank you
It runs everything in a sandbox. Look up Snekbox if you want more info.
There was a challenge a while back to create a code obfuscator, with results on the esoteric-python-challenges GitHub repo.
!e
import sys
def __match__(obj):
try:
return obj.__match__
except AttributeError:
return obj.__eq__
class case:
def __init__(self, o):
self.o = o
def __hash__(self):
return 0
def match(x):
f = sys._getframe(1)
def wrapper(cases):
for key, value in cases.items():
if __match__(x)(key.o) or __match__(key.o)(x):
exec(value, f.f_globals, f.f_locals)
return wrapper
def x():
y = 32
match(1) ({
case(0): (
"print('0')"
),
case(2): (
"print('2')"
),
case(1): (
"print(y)"
)
})
x()
@steep mural :white_check_mark: Your eval job has completed with return code 0.
32
Kinda cool
Quite concise, too.
What the bleep, how do you write that in python?
There has been a lot weirder things in this channel lol
!code
lemon is lemon except when lemon is not lemon;
if lemon is juice lemon is lemon,
juice is lemon, but lemon is not lemon, lemon is juice, so never juice is lemon, lemon is juice
deep
no
why not
cuz it's not deep
damn
if * is anything then is !* null
Me vs @sick hound
Cuz "lemon is lemon except when lemon is not lemon;
if lemon is juice lemon is lemon,
juice is lemon, but lemon is not lemon, lemon is juice, so never juice is lemon, lemon is juice" is not the same as "deep"
@verbal totem :white_check_mark: Your eval job has completed with return code 0.
False
!e ```py
def is_even(a: int):
b = 0
ans = True
for _ in range(b, (-1 if b < 0 else 1)):
ans = not ans
return ans
print(is_even(6))
@analog rock :white_check_mark: Your eval job has completed with return code 0.
False
that's what's confusing me
Hmm
Oh bruh
!e
def is_even(a: int):
ans = True
for _ in range(a, (-1 if a < 0 else 1)):
ans = not ans
return ans
print(is_even(6))
@verbal totem :white_check_mark: Your eval job has completed with return code 0.
True
I'm trying to make this as unreasonable as possible, while still working
Ik how to get an even number
of course, that's the point of this channel :P
Well I need helmp doing that
Hey @sick hound!
It looks like you tried to attach file type(s) that we do not allow (.zip). We currently allow the following file types: .3gp, .3g2, .avi, .bmp, .gif, .h264, .jpg, .jpeg, .mov, .mp4, .mpeg, .mpg, .png, .tiff, .wmv, .psd, .ai, .aep, .xcf, .mp3, .wav, .ogg, .webm, .webp, .flac, .afdesign, .m4a, .csv.
Feel free to ask in #community-meta if you think this is a mistake.
w=int(input("input weight: "));print(w*0.45 if input("K or L: ").lower()=="k" else w*2.2)```
can i make this shorter
maybe perhaps using a walrus operator'?
if you really need the input prompts, the obvious way is:
print((w:=int(input("input weight: ")))*.45 if input("K or L: ") in 'Kk' else w*2.2)
does not seem much shorter, though
welcome
yea it does not work if u input L
"w" is not defined
thats been happening to me the entire time so thats why i came here for help
lol
oh, right I see, you need the execution order
print(int(input("input weight: "))*(0.45if input("K or L: ")in"kK"else 2.2))```
well, that works
Does anyone know how to define a native coroutine (so that inspect.iscoroutinefunction is True) in a oneliner? Ideally, I want to avoid calling types.CodeType. Using eval is obviously cheating. It must not hardcode any bytecode.
!d types.coroutine
types.coroutine(gen_func)```
This function transforms a [generator](../glossary.html#term-generator) function into a [coroutine function](../glossary.html#term-coroutine-function) which returns a generator-based coroutine. The generator-based coroutine is still a [generator iterator](../glossary.html#term-generator-iterator), but is also considered to be a [coroutine](../glossary.html#term-coroutine) object and is [awaitable](../glossary.html#term-awaitable). However, it may not necessarily implement the [`__await__()`](../reference/datamodel.html#object.__await__ "object.__await__") method.
If *gen\_func* is a generator function, it will be modified in-place.
If *gen\_func* is not a generator function, it will be wrapped. If it returns an instance of [`collections.abc.Generator`](collections.abc.html#collections.abc.Generator "collections.abc.Generator"), the instance will be wrapped in an *awaitable* proxy object. All other types of objects will be returned as is.
New in version 3.5.
should do it with a lambda
It isn't a native coroutine.
(Is it?)
It isn't, I just checked. This behaviour is specified by PEP492 (https://www.python.org/dev/peps/pep-0492/#types-coroutine) and says it will not be marked as a native coroutine
False```
@fluid tree the reason why types.coroutine does not get marked as True is because it simply sets the flag CO_ITERABLE_COROUTINE on the function passed in. inspect.iscoroutinefunction checks the flag CO_COROUTINE
so what you can do is this
!e ```py
def coroutine(func):
co = func.code
func.code = co.replace(co_flags=co.co_flags|0x80)
return func
import inspect
print(inspect.iscoroutinefunction(coroutine(lambda: (() for () in ()))))```
@rugged sparrow :white_check_mark: Your eval job has completed with return code 0.
True
That uses CodeType though
it does not involve calling it
ig
afaik that is the only way to produce it as that specific flag is only set when async def ... is compiled
MY EYES
What even is a lambda?
It's an 'anonymous function'. A demonstration:
def foo(x):
return x + 1
# is equivalent to:
foo = lambda x: x + 1
Lambdas only have a single expression in them. You can't put for loops or try-except blocks in a lambda.
It's basically just lambda <PARAMETERS>: <RETURN VALUE>
You might use one when you have a small operation you want to perform, too small to warrant a function of its own. ```py
sort([-5, 4, -3, 2, -1], key=lambda number: abs(number))
(That's a bad example, because you could instead write ```py
sort([-5, 4, -3, 2, -1], key=abs)
Ok, thanks
Not the end of the world
Oh ok
I've done both, lol
That stands to reason. This is #esoteric-python Python after all.
Yeah
For try-except, did you have to import a module?
Try-catch took me over 1k characters though
Yes, sadly
I needed threading in order to comply with the pep (though most cases would work without it) and contextlib
I don't think it's possible without an import.
I suppose it's cheating to create a lambda then replace its __code__.
Or there was that not-ctypes thing abusing a lack of bounds checking in CPython to get memory access in pure Python, which also required editing bytecode.
That's fine, as long as you don't rely on implementation details.
But you can use types.FunctionType lol
Or create a lambda and replace its code.
Actually I think it's impossible
Yeah i can't create a generator without rewriting the entire thing into a line-by-line iterator and that's too much effort
@radiant anchor :white_check_mark: Your eval job has completed with return code 0.
hello
what's that fancy thing and why does it work
!charinfo 𝓹𝓻𝓲𝓷𝓽("hello")
\U0001d4f9: MATHEMATICAL BOLD SCRIPT SMALL P - 𝓹
\U0001d4fb: MATHEMATICAL BOLD SCRIPT SMALL R - 𝓻
\U0001d4f2: MATHEMATICAL BOLD SCRIPT SMALL I - 𝓲
\U0001d4f7: MATHEMATICAL BOLD SCRIPT SMALL N - 𝓷
\U0001d4fd: MATHEMATICAL BOLD SCRIPT SMALL T - 𝓽
\u0028 : LEFT PARENTHESIS - (
\u0022 : QUOTATION MARK - "
\u0068 : LATIN SMALL LETTER H - h
\u0065 : LATIN SMALL LETTER E - e
\u006c : LATIN SMALL LETTER L - l
\U0001d4f9\U0001d4fb\U0001d4f2\U0001d4f7\U0001d4fd\u0028\u0022\u0068\u0065\u006c\u006c\u006f\u0022\u0029
I guess it just parses it as normal letters, interesting
it works because "All identifiers are converted into the normal form NFKC while parsing; comparison of identifiers is based on NFKC." (https://docs.python.org/3/reference/lexical_analysis.html#identifiers)
that's...hilarious
LMAO
!e
import unicodedata
print(unicodedata.normalize('NFKC', '𝓹𝓻𝓲𝓷𝓽("hello")'))
@finite rose :white_check_mark: Your eval job has completed with return code 0.
print("hello")
I guess we're going to see much more esoteric Python code from now on 😫
we're here already 😛
Ik
this https://www.unicode.org/Public/13.0.0/ucd/DerivedCoreProperties.txt is linked in the docs and now I wonder if all blocks "something something small a..something something small z" work. we can do translator that randomly picks up a valid script and translates current code to it... because:
!e
p = 1
print(𝓹)
@finite rose :white_check_mark: Your eval job has completed with return code 0.
1
this is amazingly evil
now I think I'm gonna get into esoteric python, not only browse this channel 😄
oh my god
!e
p = "p"
print(𝓹,𝓹,sep="")
@toxic jewel :white_check_mark: Your eval job has completed with return code 0.
pp
amazing
!e py helloworld = 'hello world' 𝑝𝓇𝕚𝑛𝑡(𝒽𝕖𝑙𝑙𝕠𝕨𝑜𝑟𝓁𝕕)
@frigid wharf :white_check_mark: Your eval job has completed with return code 0.
hello world
It can normalize everything but these quotation marks ‘’ lol
diacritics etc are also non-normalisable
all alphanumerics (without diacritics) with their alternatives:
from unicodedata import normalize
result_dict = {chr(i): [] for i in range(65, 65+26)}
result_dict.update({chr(i): [] for i in range(97, 97+26)})
result_dict.update({str(i): [] for i in range(10)})
for i in range(0x10FFFF): # all valid inputs to chr - https://docs.python.org/3/library/functions.html#chr
if (norm:=normalize("NFKC", c:=chr(i))) in result_dict:
result_dict[norm].append(c)
print(result_dict)
for finding alternatives for all stuff, use defaultdict and get rid of if
!e
from unicodedata import normalize
result_dict = {chr(i): [] for i in range(65, 65+26)}
result_dict.update({chr(i): [] for i in range(97, 97+26)})
result_dict.update({str(i): [] for i in range(10)})
for i in range(0x10FFFF): # all valid inputs to chr - https://docs.python.org/3/library/functions.html#chr
if (norm:=normalize("NFKC", c:=chr(i))) in result_dict:
result_dict[norm].append(c)
# for !e, let's show only some
print(result_dict["N"])
print(result_dict["1"])
print(result_dict["c"])
@finite rose :white_check_mark: Your eval job has completed with return code 0.
001 | ['N', 'ᴺ', 'ℕ', 'Ⓝ', 'N', '𝐍', '𝑁', '𝑵', '𝒩', '𝓝', '𝔑', '𝕹', '𝖭', '𝗡', '𝘕', '𝙉', '𝙽', '🄽']
002 | ['1', '¹', '₁', '①', '1', '𝟏', '𝟙', '𝟣', '𝟭', '𝟷', '🯱']
003 | ['c', 'ᶜ', 'ⅽ', 'ⓒ', 'c', '𝐜', '𝑐', '𝒄', '𝒸', '𝓬', '𝔠', '𝕔', '𝖈', '𝖼', '𝗰', '𝘤', '𝙘', '𝚌']
!e
ⓗ𝕖𝘭l𝙤 = "Hello world!"
𝕡ʳ𝚒𝚗𝑡(𝗁𝖊l𝖑ₒ)
@finite rose :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | ⓗ𝕖𝘭l𝙤 = "Hello world!"
003 | ^
004 | SyntaxError: invalid character 'ⓗ' (U+24D7)
huh, weird, it's one of the characters that were normalized correctly...
!e
h𝕖𝘭l𝙤 = "Hello world!"
𝕡ʳ𝚒𝚗𝑡(𝗁𝖊l𝖑ₒ)
@finite rose :white_check_mark: Your eval job has completed with return code 0.
Hello world!
ⓗ normalizes to h but its unicode category is Someaning "other symbol" (or rather: symbol, other)
so obfuscation using this method requires some more tweaking than just the dict I generated above
!e
from unicodedata import normalize, category
result_dict = {chr(i): [] for i in range(65, 65+26)}
result_dict.update({chr(i): [] for i in range(97, 97+26)})
result_dict.update({str(i): [] for i in range(10)})
for i in range(0x10FFFF): # all valid inputs to chr - https://docs.python.org/3/library/functions.html#chr
if (norm:=normalize("NFKC", c:=chr(i))) in result_dict and category(c) not in ["No", "So"]:
result_dict[norm].append(c)
print(result_dict["H"])
print(result_dict["e"])
print(result_dict["1"])
print(result_dict["l"])
print(result_dict["0"])
@finite rose :white_check_mark: Your eval job has completed with return code 0.
001 | ['H', 'ᴴ', 'ℋ', 'ℌ', 'ℍ', 'H', '𝐇', '𝐻', '𝑯', '𝓗', '𝕳', '𝖧', '𝗛', '𝘏', '𝙃', '𝙷']
002 | ['e', 'ᵉ', 'ₑ', 'ℯ', 'ⅇ', 'e', '𝐞', '𝑒', '𝒆', '𝓮', '𝔢', '𝕖', '𝖊', '𝖾', '𝗲', '𝘦', '𝙚', '𝚎']
003 | ['1', '1', '𝟏', '𝟙', '𝟣', '𝟭', '𝟷', '🯱']
004 | ['l', 'ˡ', 'ₗ', 'ℓ', 'ⅼ', 'l', '𝐥', '𝑙', '𝒍', '𝓁', '𝓵', '𝔩', '𝕝', '𝖑', '𝗅', '𝗹', '𝘭', '𝙡', '𝚕']
005 | ['0', '0', '𝟎', '𝟘', '𝟢', '𝟬', '𝟶', '🯰']
whats unicode and ascii
text encodings
essentially, a way to convert a sequence of characters to bytes
and back
thanks
!e
def f():
print('Previous line repeated [992] times')
f()
f()
@odd ferry :x: Your eval job has completed with return code 1.
001 | Previous line repeated [992] times
002 | Previous line repeated [992] times
003 | Previous line repeated [992] times
004 | Previous line repeated [992] times
005 | Previous line repeated [992] times
006 | Previous line repeated [992] times
007 | Previous line repeated [992] times
008 | Previous line repeated [992] times
009 | Previous line repeated [992] times
010 | Previous line repeated [992] times
011 | Previous line repeated [992] times
... (truncated - too many lines)
Full output: too long to upload
Some extra information: Unicode is kind of three different text encodings. UTF-8 is the one everyone uses, UTF-32 is the one some computer systems use internally, and UTF-16 is the one everyone hates. ASCII is the format used by old computer systems, or programmers who don't mind that it can only display English symbols. Unicode has >100,000 symbols, while ASCII fits into a byte.
That's sick and twisted, I love it
!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!*
@gilded adder :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | def test():
003 | ^
004 | IndentationError: expected an indented block
@gilded adder :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | def test():
003 | ^
004 | IndentationError: expected an indented block
@gilded adder :warning: Your eval job has completed with return code 0.
[No output]
@gilded adder :x: Your eval job has completed with return code 1.
001 | Enter your name: Traceback (most recent call last):
002 | File "<string>", line 4, in <module>
003 | File "<string>", line 2, in x
004 | EOFError: EOF when reading a line
@gilded adder #bot-commands for testing please (and the bot doesn't support input)
A python obfuscator that randomizes identifiers in a script, compliant with this? 🤔
whomst is writes more compact than me?
You can eliminate a space on the fourth line after the else.
ty
I started making it readable then i'm like (╯°□°)╯︵ ┻━┻
next puzzle
has_admin=lambda f:lambda m,*args:len([_ for _ in m.author.roles if _.name.lower()=='admin'])and f(m,*args)or{'async':[],'sync':['that command requires a role called admin.']}
len([_ for _ in m.author.roles if _.name.lower()=='admin'])
```is```python
[u.name.lower()for u in m.author.roles].count("admin")
has_admin=lambda f:lambda m,*args:len([_ for _ in m.author.roles if _.name.lower()=='admin'])and f(m,*args)or{'async':[],'sync':['that command requires a role called admin.']}
```is```py
has_admin=lambda f:lambda*args:len([_ for _ in args[0].author.roles if _.name.lower()=='admin'])and f(*args)or{'async':[],'sync':['that command requires a role called admin.']}
```although it only matters if you shorten `args`' name.
I assume f always returns something truthy.
!e ```py
import ast
from unicodedata import normalize, category
import random
variations = {}
for i in range(0x10FFFF):
if category(c:=chr(i)) in ('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl'):
norm = normalize("NFKC", c)
if norm in variations:
variations[norm].append(c)
else:
variations[norm] = [c]
def randomize_identifiers(code):
c = ast.parse(code)
for i in ast.walk(c):
try:
i.id = ''.join(random.choice(variations.get(char, char)) for char in i.id)
except AttributeError:
pass
return ast.unparse(c)
print(randomize_identifiers('''hello_world = "hello world"
print(hello_world)'''))```
@frigid wharf :white_check_mark: Your eval job has completed with return code 0.
001 | 𝚑𝗲ⅼ𝖑𝔬_𝘄𝚘𝕣𝖑𝒅 = 'hello world'
002 | 𝗉𝓻ⅈ𝖓ᵗ('hello_world')
a script which randomizes identifiers in a script
variations[norm] = []
Shouldn’t that bevariations[norm] = [c]?
Where did the extra quote marks come from?
i edited the script and didn't reevaluate the output
import sys
print(sum(int(x)if x.isdigit()else ord(x)for x in sys.argv[1].split(',')))
``` anyway to shortern this?
(ord,int)[x.isdigit()](x)maybe
yeah, i was doing that, but messed up
import sys
print(sum((ord,int)[x.isdigit()](x)for x in sys.argv[1].split(',')))
But if you do getattr, it wouldn't work?
That's tricky because python is a dynamic language
I don’t think so since it won’t be parsed as an identifier but a string
parse AST and replace the appropriate nodes?
of course won't catch getattr or globals() mess
I've been doing this, it's tricky. Take a look at ast-scope (not the pypi version but the fork of that on github)
Beautiful. I didn't know about ast.
I did a similar filtering above for the dict but did "category not in" - digits can also be parts of identifiers, just not at the start of one. But since we parse already written code, we only need valid replacements
can't think of anything shorter for this. is this the shortest?
after this amma try the longest 😛
import sys
for i in range(128):vars()[chr(i)]=i
print(sum(eval(sys.argv[1])))
``` if you are a bad person and can guarantee that between the commas it is only valid identifiers
i didn't under stand the for loop part
it creates a variable with the every single character letter as the name and it's ord as the value
so eval will use it
ah smart
def fun():
val = yield from (yield (yield from (yield fun())))
if val is fun:
yield [['You'], ['Win']]
else:
raise ValueError
```get the `[['You'], ['Win']]` list from the `fun()` generator by making the yield actually run.
print([list(next(iter(fun())).gi_code.co_consts[-2:])]) makes the yield run ig
[['You', 'Win']] is not [['You'], ['Win']]
oh yeah my bad
what is this
python
!e ```py
def fun():
val = yield from (yield (yield from (yield fun())))
if val is fun:
yield [['You'], ['Win']]
else:
raise ValueError
def wut():
return fun
yield
gen = fun()
next(gen)
gen.send([])
print(gen.send(wut()))```
@stark fable :white_check_mark: Your eval job has completed with return code 0.
[['You'], ['Win']]
@proper vault
can anyone help me?
don't ask to ask, and just ask your question anyway
there's someone here pretty much at all times
ok Consider the following code:
val = 25
def example():
global val
val = 15
print (val)
print (val)
example()
print (val)
What is output?
you might want to ask that kind of stuff in a general help channel in the future, though it is a bit weird I have to admit
ok
factorial = lambda b:(lambda a:a(a))(lambda a:lambda b:(lambda c:lambda d:a(a)(b-1)(c)(c(d)))if b else lambda a:lambda a:a)(b)(lambda b: lambda a:a(b(lambda a:lambda a:a)(b(lambda a:lambda b:a)(lambda a:lambda b:lambda c:a(b)(b(c))))(lambda a:lambda a:a))(lambda a:lambda c:b(lambda a:lambda a:a)(a)(a(c))))(lambda a:a(lambda a:a)(lambda a:a))(lambda a:lambda b:a)(lambda a:a+1)(0)``` why does this fail on numbers above 7, if you don't know that you probably shouldn't be in this channel
thanks
nice @stark fable
def wut():
return fun
yield``` this function is pretty funny
yeah
that yield is never actually executed but it still causes the function to be a generator
so if you execute it, it you do a Stopiteration: fun, wouldn't it?
yeah i think that's what happens
>>> sys.setrecursionlimit(5042)
>>> factorial(7)
Traceback (most recent call last):
File "<stdin>", line 1, in <lambda>
File "<stdin>", line 1, in <lambda>
File "<stdin>", line 1, in <lambda>
[Previous line repeated 997 more times]
RecursionError: maximum recursion depth exceeded
>>> sys.setrecursionlimit(5043)
>>> factorial(7)
5040
``` nice!
only 5043 stack frames needed for 7! How many for 8!?
okay, it just segfaulted my interpreter 😂
haha true
!e ```py
#Empty class
empty = type("Empty", (), {})
#Adding a method and a field to Empty
def XplusY(self):
print(self.X + " and " + self.Y)
empty.Y = "This is Y"
empty.XplusY = XplusY
#Testing with instance
instance = empty()
instance.X = "This is X"
instance.XplusY()
@low apex :white_check_mark: Your eval job has completed with return code 0.
This is X and This is Y
Best way to make a class?!?!
instance = type("Empty", (), {"Y":"This is Y", "XplusY":lambda self: print(self.X, "and", self.Y)})
I know I know, I just liked the idea of adding stuff to the class after its definition
!e hash(-2)==hash(-1)
@analog shadow :warning: Your eval job has completed with return code 0.
[No output]
!e print(hash(-2) == hash(-1))
@analog shadow :white_check_mark: Your eval job has completed with return code 0.
True
Why?????!!
@analog shadow -1 is a reserved value for hash (if -1 is returned, then CPython assumes an error was meant to be raised)
So is hash only meant to be used on positive numbers? I thought that certain parts of python hashed things to compare equality
Like dict lookups
@snow beacon :white_check_mark: Your eval job has completed with return code 0.
-2
The other negatives are fine, as you can see.
!e alright I made this thing
(c1:=(c0:=....__class__.__class__("Cursed",(object,),{'__init__':(lambda s,*a:s.__class__(*[(f:=a[0]),*f(*a[1:])]))}))(lambda *a:[print(*a,sep='\n')or c0],4,2,0))(lambda*a:None,None)
and halfway through writing it i forgot why i was writing it
!e ```py
(c1:=(c0:=....class.class("Cursed",(object,),{'init':(lambda s,a:s.class([(f:=a[0]),*f(*a[1:])]))}))(lambda *a:[print(a,sep='\n')or c0],4,2,0))(lambdaa:None,None)
@floral meteor :x: Your eval job has completed with return code 1.
001 | 4
002 | 2
003 | 0
004 | <class '__main__.Cursed'>
005 | <class '__main__.Cursed'>
006 | <class '__main__.Cursed'>
007 | <class '__main__.Cursed'>
008 | <class '__main__.Cursed'>
009 | <class '__main__.Cursed'>
010 | <class '__main__.Cursed'>
011 | <class '__main__.Cursed'>
... (truncated - too many lines)
Full output: too long to upload
oh i see
okay question: will this work in an async function?
except Exception as e:await ....__class__.__class__("cursedcoro",(client.fetch_member(0).__class__,),{'__await__':staticmethod(lambda:print(f"{e.__class__.__name__}: {e}"))})
__await__ will be None?
No brackets necessary, but are those all the parameters you need?
I've got e, I just wanna obfuscate printing the error :P
and client is global
don't ask why I'm obfuscating a discord bot
But do you need a self?
tru dat
Or staticmethod if you want to be more obfuscated.
!e ```py
print(staticmethod)
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
<class 'staticmethod'>
It's a decorator.
funnily enough ....__class__.__class__ is slightly more readable than type
I'm not sure I agree.
type is like what's a type oh that's the mechanics behind class.
....class.class is like hey that's the class class!
type(type)(type(type)) is type.
maybe i hang around here too much
Whenever I see a dunder beginning with 'c' I assume it's __call__.
!e ```py
print(....class.class(....class.class)(....class.class(....class.class))==type)
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
True
is rather than == would be more precise.
but then id need a space after the s
I wasn't aware you were aiming for concision.
lmao
Also, you've got extra spaces before all of the brackets.
yeah that was a copy paste accident
Excuse me while I silently raise an eyebrow.
if the fear of space is called astrophobia, and the fear of lack of space is claustrophobia, what does that make the fear of spaces?
claustrophilia?
Astrophobias?
One fear of space = 'astrophobia'. Two fear of spaces = 'astrophobias'.
ithinkclaustrophiliaisspoton
[or,should,i,do,this,instead]?
!e ```py
print({'going'+chr(32)+'insane':True})
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
{'going insane': True}
!e ```py
print.call((lambda*d:f"{d[0].iter().next()},{d[0][d[0].iter().next()]}".replace(',',chr(32)))({'Hello':"World!"}))
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
Hello World!
claustrophilic Hello World script with a .call added so the print keyword would colour in the slightly inaccurate discord colouration
!e ```py
print("Hello","World!")
@snow beacon :white_check_mark: Your eval job has completed with return code 0.
Hello World!
I wrote a hello world without imports or brackets a while back.
no brackets, so no __call__ing so no print or sys.stdout.write
aye
so no sys.stdout.write
!e
so we have print what can we do with that?
print(dir(print.__call__.__code__))
@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 | AttributeError: 'method-wrapper' object has no attribute '__code__'
method wrapper
It's built-in, so it has no code.
!e print(dir(print.call.class))
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
['__call__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__name__', '__ne__', '__new__', '__objclass__', '__qualname__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__text_signature__']
You can call some things without brackets. For instance, ~x calls x.__invert__().
You can also define functions without brackets, e.g. lambda x, *y, **z: z + y + z.
I reckon you'll hit some roadblocks, but I've got to go now.
yeah a class still needs to ba called
i can use an object that already exists!
!e ```py
exit.inverse.call=print.call
~exit
@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 'exit' is not defined
!e ```py
exit()
@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 'exit' is not defined
@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 | AttributeError: 'str' object has no attribute '__inverse__'
>>> class
File "<stdin>", line 1
class
^
SyntaxError: invalid syntax
>>> class=4
File "<stdin>", line 1
class=4
^
SyntaxError: invalid syntax
>>> globals().update({'class':'ahahaahahaahaha'})
>>> class
File "<stdin>", line 1
class
^
SyntaxError: invalid syntax
>>> globals()
{'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': <class '_frozen_importlib.BuiltinImporter'>, '__spec__': None, '__annotations__': {}, '__builtins__': <module 'builtins' (built-in)>, 'class': 'ahahaahahaahaha'}
!e ```py
n=69
n.neg=print
-n
@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 | AttributeError: 'int' object attribute '__neg__' is read-only
!e ```py
try:raise Exception
except Exception as e:e.neg=print;-e
@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 | Exception
004 |
005 | During handling of the above exception, another exception occurred:
006 |
007 | Traceback (most recent call last):
008 | File "<string>", line 2, in <module>
009 | TypeError: bad operand type for unary -: 'Exception'
!e ```py
print(int.setattr)
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
<slot wrapper '__setattr__' of 'object' objects>
!e object.inverse
@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 | AttributeError: type object 'object' has no attribute '__inverse__'
!e object.neg
@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 '__object__' is not defined
!e object.neg
@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 | AttributeError: type object 'object' has no attribute '__neg__'
!e ....neg
@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 | AttributeError: 'ellipsis' object has no attribute '__neg__'
!e ....gt
@floral meteor :warning: Your eval job has completed with return code 0.
[No output]
!e ```py
a=...
a.setattr=print
a.Hello='World!'
@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 | AttributeError: 'ellipsis' object attribute '__setattr__' is read-only
@floral meteor :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: bad operand type for unary -: 'type'
!e ```py
....str=lambda s:"yeet"
@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 | AttributeError: 'ellipsis' object attribute '__str__' is read-only
!e ```py
def a:...
@floral meteor :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | def a:...
003 | ^
004 | SyntaxError: invalid syntax
!e ArithmeticError.a=4
@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: can't set attributes of built-in/extension type 'ArithmeticError'
!e
lis = [[[[[[[[[["Hello, world!",[]],[]],[]],[]],[]],[]],[]],[]],[]],[]]
print(lis[0][0][0][0][0][0][0][0][0][0])
@lone scarab :white_check_mark: Your eval job has completed with return code 0.
Hello, world!
!e ```py
(lis:=list()).append(lis)
lis[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0]=lis
lis.str='hello world'
lis.neg=print
-lis
@floral meteor :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 3, in <module>
003 | AttributeError: 'list' object attribute '__str__' is read-only
okay apparently the fear of whitespace is called horror vacui
That's a lot of bot executions. I guess it's in your name.
I feel bad for having led you down something that's probably the wrong path.
I didn't use ~, - etc for my hello world.
In [1]: x = lambda:0
In [2]: x.__invert__ = print
In [3]: ~x
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
----> 1 ~x
TypeError: bad operand type for unary ~: 'function'
```This doesn't work, for one.
Using dunder methods is one of multiple ways to call functions.
idk about them but i just found a solution and it uses ||decorators||
(spoilering that because it's quite a major hint)
I love how you use those images even tho your nitro ended 
x=lambda*_:'hello world'
@print
@x
class A:0```
Or in 3.9
@print
@lambda*_:'hello world'
class A:0
Now I understand the use case of expressions in decorators 😛
Haha
We have private methods and public methods, how about unlockable methods?
class Base:
x = 3
def __init__(self, y):
self.y = y
def x_Plus_y(self):
return self.x + self.y
@classmethod
def unlock_More_Methods(cls):
cls.x_Times_y = lambda self: self.x * self.y
@staticmethod
def hello_World():
print("Hello World!")
cls.hello_World = hello_World
hello guys can someone help me? my vscode doesn't color my string, is that correct?
print('\033[0;31;43mText\033[m')
my terminal send this
←[1;32mText←[m
In Pycharm this work, but in vscode this don't work ;-;
and when u run via terminal?
Lol, I like it to use in pycharm
Dont work
yes, that would have been very nice for my scripts too....but..
if you find something you can let me know?
try it in a bash
i think it will work there
I agree
Yes obvious
I don't use bash
;-;
@wanton jacinth i think this will help you to use colors and styles in python
@wanton jacinth hey i found one way to use it in vscode, you shoud use "import colorama and colorama.init()" and later use print('\033[0;31;43mText\033[m')
===============================================
from termcolor import colored
import colorama
colorama.init()
#this way uses termcolor, is too easy to use
print(colored('this way wil work', 'blue'))
#This way is confusing to understand, but it works to
print('\033[0;31;43mText\033[m')
!e __𝓲𝓶𝓹𝓸𝓻𝓽__("__hello__")
@sudden willow :white_check_mark: Your eval job has completed with return code 0.
Hello world!
All you need to do is
__import__('os').system("")
In order for ANSI escape sequences like that to work.
Must be empty string
This function will abstract away printing green text
def get_print_green(__l,name='print_green',default=__import__('sys').stdout):
print_green=lambda*args,sep=chr(32),end=chr(10),file=default:__import__('os').system("")or file.write(f"\x1b[32m{sep.join(args)}{end}\x1b[0m")
__l.update({name:print_green})
get_print_green(locals())
I did not know you could decorate classes
♧
!e ```py
@print
@lambda*_:"I am invincible!"
class __:...
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
I am invincible!
!e ```py
@print
def yeet(s): return s
yeet('hi')
@floral meteor :x: Your eval job has completed with return code 1.
001 | <function yeet at 0x7f79c7ddd040>
002 | Traceback (most recent call last):
003 | File "<string>", line 3, in <module>
004 | TypeError: 'NoneType' object is not callable
!e a=lambda*_:None
a.str="Hello World!"
@print
a
@floral meteor :x: Your eval job has completed with return code 1.
001 | File "<string>", line 4
002 | a
003 | ^
004 | SyntaxError: invalid syntax
Awwwww
Now I'm thinking of.................................
| O
_________________________
A | | B | C | N | M
Such that
O=(A&B&C¬+N)^M
now we make that a class, connect Os to respective letters and connect some input nodes to stimuli and boom we've made something like a brain
lel
@toxic jewel :white_check_mark: Your eval job has completed with return code 0.
test
try starring both xs
hmm
!e ```py
(lambda*x:print(*x))("test")
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
test
boom
!e (lambda*x:print(*x))("Hello","World!")
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
Hello World!
you know what's quirky?
!e
(lambda*:print(*))("test")
@toxic jewel :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | (lambda*:print(*))("test")
003 | ^
004 | SyntaxError: named arguments must follow bare *
!e ```py
@print
@lambda*_:"Hello World"
class _:...
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
Hello World
!e
@print
@{}.__class__
you need a class
!e
@print
@{}.__class__
class _:...
@toxic jewel :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: 'type' object is not iterable
wait so i can fit all my non-space code in a decorator?
!e
@print
@(lambda*x:print(x))("t")
class _:...
@toxic jewel :x: Your eval job has completed with return code 1.
001 | ('t',)
002 | Traceback (most recent call last):
003 | File "<string>", line 3, in <module>
004 | TypeError: 'NoneType' object is not callable
huh
!e ```py
@print
@lambda :.name
class _:name="Hello World!"
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
_
woah
!e ```py
@print
@lambda :.str
class _:str="Hello World"
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
Hello World
!e e=1j;print(e)
@toxic jewel :white_check_mark: Your eval job has completed with return code 0.
1j
sucks that i can't fit my decorators into one line
!e ```py
@print
@lambda :.complex
class _:complex=1j
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
1j
oh you want one-liners? You need a lot of brackets
:thonk:
!e ```py
c=lambda*d:lambda f:[(f:=e(f))for e in reversed(d)]
@c(print,lambda :.)
class _:="Hello World"
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
Hello World
like that?
otherwise you'd be calling the lambda on the print on the class when you want to print the lambda of the class
aren't decorators just calling decorator_name(func) aswell
!e [lambda*d:lambda f:[(f:=e(f))for e in reversed(d)]][""==()].__call__(print,lambda _:_.__).__call__(....__class__.__class__("",(),{'__':"Hello World"}))
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
Hello World
going 2 brag 2 mudkip that i finally know how his code works brb
!e ```py
[lambdad:lambda f:[(f:=e(f))for e in reversed(d)]][str()==()].call(print,lambda :.).call(....class.class(().str().class(),().class(),{'':11'%c'%(lambdaa:([+t+100for t in a],))(-28,--1,--8,--8,11,-68,-13,11,14,--8,+0)}))
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
Hello World
@toxic jewel how about the above?
damn
I do believe that if you append a [0] it will also return the value
as well as printing
!e ```py
print([lambdad:lambda f:[(f:=e(f))for e in reversed(d)]][str()==()].call(print,lambda :.).call(....class.class(().str().class(),().class(),{'':11'%c'%(lambdaa:([+t+100for t in a],))(-28,--1,--8,--8,11,-68,-13,11,14,--8,+0)}))[0])
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | Hello World
002 | Hello World
you see?
wizardry
!e ```py
print(~[0,1,2,3,4,5])
@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: bad operand type for unary ~: 'list'
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
b
!e print(("YEET"))
@floral meteor :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | print(*(*"YEET"))
003 | ^
004 | SyntaxError: can't use starred expression here
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
A A A A A A A
!e print(*"\n"*8,sep="A "*8,end='\n\n')
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 |
002 | A A A A A A A A
003 | A A A A A A A A
004 | A A A A A A A A
005 | A A A A A A A A
006 | A A A A A A A A
007 | A A A A A A A A
008 | A A A A A A A A
!e print(*['']*8,sep=' '.join('A'*8)+'\n')
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | A A A A A A A A
002 | A A A A A A A A
003 | A A A A A A A A
004 | A A A A A A A A
005 | A A A A A A A A
006 | A A A A A A A A
007 | A A A A A A A A
!e ```py
print_n_times=lambda n:lambda f:lambdaargs,sep=' ',end='\n':print(['']*n,sep=sep.join(args)+end)
@print_n_times(8)
def yeet(args,**kwargs):...
yeet("A"*8)
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | A A A A A A A A
002 | A A A A A A A A
003 | A A A A A A A A
004 | A A A A A A A A
005 | A A A A A A A A
006 | A A A A A A A A
007 | A A A A A A A A
!e ```py
def matrix(a,b):
def a(f):
def w(letter):
@(lambda n:lambda f:lambdaargs,sep=' ',end='\n':print(['']*n,sep=sep.join(args)+end))(a)
def yeet(*args,**kwargs):...
yeet(letterb);return letter
return w
return a
@matrix(8,8)
def b(letter):...
b("A")
@floral meteor :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 11, in <module>
003 | File "<string>", line 6, in w
004 | File "<string>", line 4, in <lambda>
005 | TypeError: can't multiply sequence by non-int of type 'function'
alrighty then here goes
!e ```py
def matrix(a,b):
def a(f):
def w(l):
def k(n):
def c(g):
def p(s,sep=' ',end='\n'):print(['']*n,sep=sep.join(s)+end)
return p
return c
@k(a)
def yeet(*args,**kwargs):...
yeet(lb);return letter
return w
return a
@matrix(8,8)
def _(o):...
_("A")
@floral meteor :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 16, in <module>
003 | File "<string>", line 11, in w
004 | File "<string>", line 6, in p
005 | TypeError: can't multiply sequence by non-int of type 'function'
maybe i should name the varibles in order
!e ```py
def a(b,c):
def d(e):
def f(g):
def h(i):
def j(k):
def l(m,n=' ',o='\n'):
print(['']*i,sep=n.join(m)+o)
return l
return j
@d(b)
def p(*q,**r):...
p(gc);return g
return f
return d
@a(8,8)
def s(t):...
s("A")
@floral meteor :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 17, in <module>
003 | File "<string>", line 11, in f
004 | File "<string>", line 11, in f
005 | File "<string>", line 11, in f
006 | [Previous line repeated 995 more times]
007 | File "<string>", line 10, in f
008 | RecursionError: maximum recursion depth exceeded
all i did was rename stuff
alright reject def embrace lambda
nah i think i'll go to sleep
!e ```py
def a(A):
def b(B):
def c(C):
def d(D):
def e(E):
def F(f):return lambda:f(A,B,C,D,E)
return F
return e
return d
return c
return b
@a(1)(2)(3)(4)(5)
def yeet(*args):print(*args,sep='\n')
yeet()
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | 1
002 | 2
003 | 3
004 | 4
005 | 5
!e ```py
def a(A):
def b(B):
def c(C):
def d(D):
def e(E):
def f(F):return lambda G:lambda H:lambda I:lambda J:lambda K:lambda L:lambda f:lambda:f(A,B,C,D,E,F,G,H,I,J,K,L)
return F
return e
return d
return c
return b
@a("H")("E")("L")("L")("O")(chr(32))("W")("O")("R")("L")("D")("!")
def yeet(*args):print(*args,sep='\n')
yeet()
@floral meteor :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 7, in e
004 | NameError: name 'F' is not defined
!e ```py
def a(A):
def b(B):
def c(C):
def d(D):
def e(E):
def f(F):
def g(G):
return lambda H:lambda I:lambda J:lambda K:lambda L:lambda f:lambda:f(A,B,C,D,E,F,G,H,I,J,K,L)
return F
return e
return d
return c
return b
@a("H")("E")("L")("L")("O")(chr(32))("W")("O")("R")("L")("D")("!")
def yeet(*args):print(*args,sep='\n')
yeet()
@floral meteor :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 14, in <module>
003 | File "<string>", line 9, in e
004 | NameError: name 'F' is not defined
!e ```py
def a(A):
def b(B):
def c(C):
def d(D):
def e(E):
def f(F):
def g(G):
return lambda H:lambda I:lambda J:lambda K:lambda L:lambda z:lambda:z(A,B,C,D,E,F,G,H,I,J,K,L)
return g
return f
return e
return d
return c
return b
@a("H")("E")("L")("L")("O")(chr(32))("W")("O")("R")("L")("D")("!")
def yeet(*args):print(*args,sep='')
yeet()
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
HELLO WORLD!
boom

!e
class E:
def __eq__(self, other): return lambda: print("lol")
(E() == E())()
beat that for crazy
@viscid nymph :white_check_mark: Your eval job has completed with return code 0.
lol
should I fully expand it or introduce my bluetooth_headphones decorator?
!e ```py
def a(A):
def b(B):
def c(C):
def d(D):
def e(E):
def f(F):
def g(G):
def h(H):
def i(I):
def j(J):
def k(K):
def l(L):
def m(M):
def n():
return M(A, B, C, D, E, F, G, H, I, J, K, L)
return n
return m
return l
return k
return j
return i
return h
return g
return f
return e
return d
return c
return b
@a("H")("e")("l")("l")("o")(chr(32))("W")("o")("r")("l")("d")("!")
class O:init=lambda s,*t:s.setattr('t',t);eq=lambda s,o:print(*s.t,sep='')
O()==O
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
Hello World!
@viscid nymph I combined our ideas
Oh wow lol
now I'll just work on your idea, but make it a little bit cursed, if you don't mind?
Of course
There you go.
!e ```py
class O:eq=lambda s,o:print(*o,sep='')
O()=="Hello World!"
O()==['Hello',' ','World','!']
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | Hello World!
002 | Hello World!
!e ```py
class stdout:le=lambda s,o:print(o,end='')
class sprintf:new=lambda c,*args,sep=' ',end='\n':sep.join(args)+end
stdout() <= sprintf("Hello","World",end='!')
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
Hello World!
there I think I'm satisfiied with it
It looks far more readable than print("Hello World",end='!', file=import('sys').stdout)
!e ```py
class stdout:le=lambda s,o:print(o,end='')
class sprintf:new=lambda c,s,*args,end='\n':s.format(*args)+end
stdout() <= sprintf("{} {}","Hello","World",end='!')
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
Hello World!
this chat is fun as always
aye look what I did to that function's documentation
wizardry
!e ```py
class BluetoothHeadphones:
def new(c,f):
f.doc="""Low Battery""".join([f.doc[i:i+(30-len('Low Battery'))]for i in range(0,len(f.doc),30)])+"Power off"if f.doc is not None and len(f.doc)>30 else f.doc
return f
class stdout:le=lambda s,o:print(o,end='')
@BluetoothHeadphones
def yeet(*args,**kwargs):
"""Actually just prints the stuffs, it's essentially the same as print, except it might run out of battery before it finishes. You gotta love technology ahahahahahaha"""
yield args;yield kwargs
stdout() <= yeet.doc
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
Actually just printLow Batterys, it's essentiallyLow Batterys print, except it Low Batteryut of battery beforLow Batteryes. You gotta love Low BatteryahahahahahahaPower off
i seen a lot of it in this channel
!e ```py
def self(n=0):
from sys import _getframe as e
f=lambda:None
f.code=e(n+1).f_code
return f
class stdout:le=lambda s,o:print(o,end='')
make_zero=lambda n:n and self()(n-1)
stdout() <= make_zero(8)
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
0
this the type of stuff that doesnt even look like python code
it's the way the language was meant to be written
!e ```py
def self(n=0):
from sys import _getframe as e
f=lambda:None
f.code=e(n+1).f_code
return f
class stdout:le=lambda s,o:print(o,end='')
make_empty=lambda a:a and self()(a[:-1])
s=stdout()
s <= make_empty("wheeeeeeee")
s <= make_empty([2,6,72,0,8,4,4])
yaha you can't print an empty string
made this and was curious if its considered esoteric ?
Test = type("____", (), {"__init__": lambda self, **_: exec(f"for __, ___ in zip({_}.keys(), {_}.values()): setattr(self, __, ___)")})
number = Test(x = 5, y = 6)
print(number.x * number.y)
!e ```py
stdout=....class.class("echo",(),{'le' :lambda self, o:print(o,end='')})()
number=....class.class("_",(),{"init":lambda self,**:exec(f"for __, ___ in zip({}.keys(), {}.values()): setattr(self, __, ___)")})(x=5,y=6)
stdout <= number.x*number.y
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
30
that's the esotericer version
love it

there
this is art
!e ```py
s=....class.class("_",(....class.class("echo",(),{'le':lambda self,o:print(o,end='')}),),{"init":lambda self,**:exec(f"for __, ___ in zip({}.keys(), {}.values()): setattr(self, __, ___)")})(x=5,y=6)
s <= s.x*s.y
fr
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
30
are you trying to compress it all into 1 line
prob
sorry i ever doubted anything in this life
!e ```py
(s:=....class.class("_",(....class.class("echo",(),{'le':lambda self,o:print(o,end='')}),),{"init":lambda self,**:exec(f"for __, ___ in zip({}.keys(), {}.values()): setattr(self, __, ___)")})(x=5,y=6)) <= s.x*s.y
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
30
nice :=
!e ```py
(s:=....class.class("_",(),{'le':lambda self,o:print(o,end=''),"init":lambda self,**:exec(f"for __, ___ in zip({}.keys(), {}.values()): setattr(self, __, ___)")})(x=5,y=6)) <= s.x*s.y
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
30
and its golfing time
_>
!e ```py
print(30)
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
30
there

i wonder if you can make this even shorter
i don't think so
nope
!e ```py
mul=lambda a,b:(s:=....class.class("_",(),{'le':lambda self,o:print(o),"init":lambda self,**:exec(f"for __, ___ in zip({}.keys(), {}.values()): setattr(self, __, ___)")})(x=a,y=b)) <= s.x*s.y
mul(5,6)
mul(3,10)
mul(20,21)
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | 30
002 | 30
003 | 420
!e ```py
stdout=....class.class("stdout",(),{'le':lambda self,o:print(o,end='')})()
stdout <= "Hello "
stdout <= "World!"
stdout <= '\n'
stdout <= "XDDDDDDDDDDDDDDD\n"
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | Hello World!
002 | XDDDDDDDDDDDDDDD
what are those ....?
so weird
ellipsis and getattribute
how can you get an attr from ellipsis?
This looks so cool, please explain what's going on through the entire code pls
!e ```py
stdout=....class.class("stdout",(),{'le':lambda self,o:[lambda*d:lambda f:[(f:=e(f))for e in reversed(d)]][str()==()].call(print,lambda :.).call(....class.class(().str().class(),().class(),{'':o}))})()
stdout <= "Hello World!"
stdout <= "XDDDDDDDDDD"
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
001 | Hello World!
002 | XDDDDDDDDDD
ohhhk, looks like im in my own /tableflip
and sometimes even worst
just 3 monts in it
good luck staying in this channel you will need it
I could walk you through, but don't ask what the ellipsis is supposed to be used for cos idk
!e print(...)
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
Ellipsis
see?
@neat verge :warning: Your eval job has completed with return code 0.
[No output]
!e print(dir(Ellipsis))
@floral meteor :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__']
oh ok
that's all the attributes of ellipsis
(lambda _, __, ___, ____, _____, ______, _______, ________:
getattr(
__import__(True.__class__.__name__[_] + [].__class__.__name__[__]),
().__class__.__eq__.__class__.__name__[:__] +
().__iter__().__class__.__name__[_:][_____:________]
)(
_, (lambda _, __, ___: _(_, __, ___))(
lambda _, __, ___:
bytes([___ % __]) + _(_, __, ___ // __) if ___ else
(lambda: _).__code__.co_lnotab,
_ << ________,
(((_____ << ____) + _) << ((___ << _____) - ___)) + (((((___ << __)
- _) << ___) + _) << ((_____ << ____) + (_ << _))) + (((_______ <<
__) - _) << (((((_ << ___) + _)) << ___) + (_ << _))) + (((_______
<< ___) + _) << ((_ << ______) + _)) + (((_______ << ____) - _) <<
((_______ << ___))) + (((_ << ____) - _) << ((((___ << __) + _) <<
__) - _)) - (_______ << ((((___ << __) - _) << __) + _)) + (_______
<< (((((_ << ___) + _)) << __))) - ((((((_ << ___) + _)) << __) +
_) << ((((___ << __) + _) << _))) + (((_______ << __) - _) <<
(((((_ << ___) + _)) << _))) + (((___ << ___) + _) << ((_____ <<
_))) + (_____ << ______) + (_ << ___)
)
)
)(
*(lambda _, __, ___: _(_, __, ___))(
(lambda _, __, ___:
[__(___[(lambda: _).__code__.co_nlocals])] +
_(_, __, ___[(lambda _: _).__code__.co_nlocals:]) if ___ else []
),
lambda _: _.__code__.co_argcount,
(
lambda _: _,
lambda _, __: _,
lambda _, __, ___: _,
lambda _, __, ___, ____: _,
lambda _, __, ___, ____, _____: _,
lambda _, __, ___, ____, _____, ______: _,
lambda _, __, ___, ____, _____, ______, _______: _,
lambda _, __, ___, ____, _____, ______, _______, ________: _
)
)
)
btw any chance you remember/know who made this masterpiece a while ago ?
Is this some kinf of easter egg in py, the ellipsis?
probably
Tha hell
yeah that's advanced python
so everything in python is actually either an object or an operator and an operator is just a shortcut to call an attribute of an object
I still have Decorators and Async programming to learn and thats all I have left in Basic Py
@neat verge run that code btw, result is fun for code complexity and size
👍
!e
(lambda _, __, ___, ____, _____, ______, _______, ________:
getattr(
__import__(True.__class__.__name__[_] + [].__class__.__name__[__]),
().__class__.__eq__.__class__.__name__[:__] +
().__iter__().__class__.__name__[_:][_____:________]
)(
_, (lambda _, __, ___: _(_, __, ___))(
lambda _, __, ___:
bytes([___ % __]) + _(_, __, ___ // __) if ___ else
(lambda: _).__code__.co_lnotab,
_ << ________,
(((_____ << ____) + _) << ((___ << _____) - ___)) + (((((___ << __)
- _) << ___) + _) << ((_____ << ____) + (_ << _))) + (((_______ <<
__) - _) << (((((_ << ___) + _)) << ___) + (_ << _))) + (((_______
<< ___) + _) << ((_ << ______) + _)) + (((_______ << ____) - _) <<
((_______ << ___))) + (((_ << ____) - _) << ((((___ << __) + _) <<
__) - _)) - (_______ << ((((___ << __) - _) << __) + _)) + (_______
<< (((((_ << ___) + _)) << __))) - ((((((_ << ___) + _)) << __) +
_) << ((((___ << __) + _) << _))) + (((_______ << __) - _) <<
(((((_ << ___) + _)) << _))) + (((___ << ___) + _) << ((_____ <<
_))) + (_____ << ______) + (_ << ___)
)
)
)(
*(lambda _, __, ___: _(_, __, ___))(
(lambda _, __, ___:
[__(___[(lambda: _).__code__.co_nlocals])] +
_(_, __, ___[(lambda _: _).__code__.co_nlocals:]) if ___ else []
),
lambda _: _.__code__.co_argcount,
(
lambda _: _,
lambda _, __: _,
lambda _, __, ___: _,
lambda _, __, ___, ____: _,
lambda _, __, ___, ____, _____: _,
lambda _, __, ___, ____, _____, ______: _,
lambda _, __, ___, ____, _____, ______, _______: _,
lambda _, __, ___, ____, _____, ______, _______, ________: _
)
)
)
@neat verge :white_check_mark: Your eval job has completed with return code 0.
Hello world!
?
i wouldnt say decorators and async are basic py, unless you talking about this channel standards
wow
decorator essentially is a function that takes a function object and returns a slightly different function object
oh
Yeah, im having trouble with that from the docs and blogs. I'm considering watching a vid
refer to this art piece
it uses decorators
Also, I have a question in #discord.py pls help if you can
👍
Saw that
No idea what that does
but that @ is a decorator
!e In this channel, decorators are used for this:
@print
@lambda _:_.__doc__
class _:"""Hello World!"""
@floral meteor :white_check_mark: Your eval job has completed with return code 0.
Hello World!
This is really so cool
thats fun
I really understand nothing from this
which is why this works:
stdout=....__class__.__class__("stdout",(),{'__le__':lambda self,o:[lambda*d:lambda f:[(f:=e(f))for e in reversed(d)]][str()==()].__call__(print,lambda _:_._).__call__(....__class__.__class__.__call__(().__str__().__class__(),().__class__(),{'_':o}))})()
stdout <= [lambda*d:lambda f:[(f:=e(f))for e in reversed(d)]][str()==()].__call__(print,lambda _:_._).__call__(....__class__.__class__(().__str__().__class__(),().__class__(),{'_':11*'%c'%(lambda*a:(*[+t+100for t in a],))(-28,--1,--8,--8,11,-68,-13,11,14,--8,+0)}))[0]
twice
🤯