#esoteric-python
1 messages · Page 134 of 1
np
!e
print(list(map(str, [1,2,3])))
@prisma coral :white_check_mark: Your eval job has completed with return code 0.
['1', '2', '3']
And you can obfuscate the builtins with that getattr thing I showed you before
and you can use a function or horrendously long lambda in place of str in print(list(map(str, [1,2,3]))) if need be.
... I forget which channel I'm in sometimes.
I was about to complain that you didn't need lambda in a list comprehension that was more of a map() thing, then noticed that it's not a list comprehension it's a generator unpacking into a list ... then I knew where I was.
inc = lambda x: int(chr(x+49))
dec = lambda x: int(chr(x+47))
"hey, why doesn't your interface work for negative numbers?"
this is my code
Instead of printing False
it prints True
i got this code before it aswell
i really cant spot the error making it print True instead of false
It's True because self != 0
If you want it to be False, self must be 0. That's what type(None).__bool__.__doc__ says
These are the first 3 items in the list which is part of your self (comments courtesy of github copilot):
___ := ((([] == [])) + (([] == []))), # 1 + 1 = 2
__ := (___) * ((([] == [])) + (([] == []))) ** ___ // ___, # 2 * 2 ** 2 // 2 = 4
____ := (__) ** ___, # 4 ** 2 = 16
Since you index into the list by ___, which is 2, you get the 3rd item, which is 16
16 != 0 so it's True
@sick hound
make self be 0 ¯_(ツ)_/¯
Yeah that works
thanks
learning here : )
@prisma coral i changed my code
line 10 and 11 change
made a variable that equal to 5 so it gets the 6th thingy which is 0
and it brings up an error
which im not sure about
, ((_________________),_______________________________________________________:=(([]==[]))+(([]==[])+([]==[]))+(([]==[])),~_______________________)]\
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: assignment expression cannot rebind comprehension iteration variable '_______________________________________________________'```
what does this mean
You've done the equivalent of this:
[i:=somevalue for i in ...]
The comprehension iteration variable is i, and you tried to change it's value
The reason this isn't allowed is because of how list comps are optimized
Whereas it's syntactically fine to do:
for i in ...:
i = somevalue
Why do you want to reassign it
variable is equal to 5, so i get the 6th thingy which is 0
so self = 0
and code returns false
thats why
But how does that relate to the looping variable?
It sounds like you are just trying to create a new variable
i
create a new variable just for the looping
so i can give it a value of 5 which gives it access to 6th number in array which is 0
is there a syntax error here?
vscode says so and its highlighting my special variable
but its not being specific
Well this doesn't make much sense:
[... for ... in range(...) := ...]
(lines 10 and 11 of the paste)
for _______________________________________________________ in range(__) _______________________________________________________\
:=(([]==[]))+(([]==[])+([]==[]))+(([]==[])) if ((_______)) !=[(([]==[]))-(___)]]][___]: eval(type(None).__bool__.__doc__))())```
which bit
oh 10 and 11
thats where the error is, idk how to fix it
I'm not sure what you were even trying to do there
Also I'm off to bed now
See y'all tomorrow
cya.
hi
I think it's awesome how the __getitem__, __setitem__, and __delitem__ protocols allow for not just indexes / keys / slices but any size tuples of the above.
But doesn't actually ship any classes that use the tuple feature, so we're all free to interpret that and implement it or not as we see fit.
So you can have one class that interprets a[1,3,6] as an index into a 3d array a[1][3][6], and another that interprets a[1,3,6] as (a[1],a[3],a[6]) either of which can come in really handy, depending on what you're doing.
@vague cairn about my code uh
?
I'm still fussing with my polymorphing lazy load proxy class
could u please read through the past convo if you have the time and try help me out
it's really not the kind of obfuscation that I enjoy.
pass it an int? or something that provides an .__index__() that returns 0
i think i can make a variable which = 5 then i can get the 6th number in my array and that will be 0
or smth
can u give an example of passing it an int
!e
def x():
self = 0
print(eval(type(None).__bool__.__doc__))
self = 1
print(eval(type(None).__bool__.__doc__))
x()
@vague cairn :warning: Your eval job has completed with return code 0.
[No output]
oh
invalid syntax. Perhaps you forgot a comma? is the error for this code
can you do __globals__.__setitem__() or something?
for ___ in range(__) if ((_______)) !=[(([]==[]))-(___)]]][___]: self == 0 eval(type(None).__bool__.__doc__))())```
it says i forgot a comma
where tho
after 0
no, self ==0 compares self to 0
self := 0 might work.
!e
x = lambda s:(self :=s, print(eval(type(None).__bool__.__doc__)))
for i in range(-2,3):
print(x(i))
@vague cairn :white_check_mark: Your eval job has completed with return code 0.
001 | True
002 | True
003 | False
004 | True
005 | True
you have to set it to something for it to be defined.
you cannot use the 'variable = expression' statement because you cannot make statements in lambdas. only expressions.
it will be easier to just show you this
however the 'variable := expression' walrus operator is not a statement, it is an expression that saves it's value to a variable as part of its side effects.
I am not parsing that.
because self != 0
right.
self = 16 as the thing im indexing the list has a value of 2 which accesses 3rd value which is 16
you are still using the == operator, which compares and evaluates to True or False depending on whether self == 0 it doesn't set anything.
you need to make it a := operator.
!e
x = lambda s:(self := s, print(eval(type(None).__bool__.__doc__), end=' : '))
for i in range(-1,2):
print(x(i))
y = lambda s:(self == s, print(eval(type(None).__bool__.__doc__), end=' : '))
for i in range(-1,2):
print(y(i))
!e
# or you could just:
x = lambda f: print(eval(type(None).__bool__.__doc__[3:]))
for i in range(-1,2):
print(x(i))
@vague cairn :white_check_mark: Your eval job has completed with return code 0.
001 | True
002 | None
003 | False
004 | None
005 | True
006 | None
How can I get the docstring of a module, if even possible?
i.e
!e
"""
print(2)
"""
exec(__doc__)
@golden finch :white_check_mark: Your eval job has completed with return code 0.
2
Wait, what?
well you got it, __doc__ is how you access it
!e
import sys
current_module = sys.modules[__name__]
print(current_module)
@fleet bridge :white_check_mark: Your eval job has completed with return code 0.
<module '__main__' (built-in)>
will it work in all cases?
this way of getting current module
imho modules should have __module__ attribute, containing module itself
@sick hound :white_check_mark: Your eval job has completed with return code 0.
__main__
>>> f=lambda a:lambda b:lambda c:((a,b,c),locals())
>>> f(3)(5)(7)
((3, 5, 7), {'c': 7, 'a': 3, 'b': 5})
>>> f=lambda a:lambda b:lambda c:((1,2,3),locals())
>>> f(3)(5)(7)
((1, 2, 3), {'c': 7})
did I ever reiterate just how much I hate python?
!e ```py
=().class.class("", (), {"init": lambda __:return })
print(.module)
@sick hound :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | print(().__class__.__class__("__", (), {"__init__": lambda __:return __}).__module__)
003 | ^^^^^^
004 | SyntaxError: invalid syntax
!e ```py
=().class.class("", (), {"init": lambda __:return })
print(.module)
@sick hound :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | __=().__class__.__class__("__", (), {"__init__": lambda __:return __})
003 | ^^^^^^
004 | SyntaxError: invalid syntax
!e ```py
=().class.class("", (), {"init": lambda : print()})
print(__.module)
@sick hound :white_check_mark: Your eval job has completed with return code 0.
__main__
Yes, and you can create classes like this without using class xD
!e
_=type('',(),{'__call__':property(lambda instance=lambda num,ins=[]:(_:=ins.__class__.__call__.fget.__defaults__[0],_.__defaults__[0].append(0)or len(_.__defaults__[0])<=num or setattr(_,'__defaults__',([],)))[1]:lambda n:instance.__class__.__call__.fget.__defaults__[0](n,instance))})()
while _(3):
print('a')
while _(2):
print('b')
@golden finch :white_check_mark: Your eval job has completed with return code 0.
001 | a
002 | a
003 | a
004 | b
005 | b
I think I know how to use type :)
no problem
I'm just blown out I learned this yesterday
Hm how come?
You learn a lot from this channel
Yup 😂
Now I have a challenge, to create a script using only dundermethods with no common builtin keyword and methods
It teaches me a lot on how stuff works behind the scenes and also I learn new magic/dunder methods
I probably will, thank you! Im going to save this link 😂
You definitely should, it's the beating heart of this channel
Also learn about metaclasses
and especially lambdas
lots and lots of lambdas
Oh I can't learn that xD
Oh you should
Yeah this I can look into, me and my friend tried to find another way of creating your own lambda function from scratch
type(lambda:0)(myCodeType)
without using lambda at all
This is the challenge xD
oh hi ur back
apple replied to us
now we have our own way of for and iter
we need to get our lambda with literally just a series of dundermethods
we can use some uncommon keywords
@vague cairn when i use walrus it says uh
cannot use assignment expressions with lambda
strangely
Have you figured out something?
lambda self=[___:=((([]==[]))+(([]==[]))) , __:=(___)*((([]==[]))+(([]==[])))**___//___ , ____:=(__)**___ ,
_______________________:=(((__))+(__))**((([]==[]))+(([]==[])))+(([]==[]))+(([]==[]))+(([]==[]))+(([]==[])) , _____________:=((___)) ,
_____________:=((___)) , _______:=(([]==[]))+(___) , _______:=((_______))+_____________ ,
______ := chr((((___)))*((((__))))**(__)+(__)//((___))) , [[((__)+(((___)))//(____)-((___))+((___)**(___)**((_______)))) ,
_________________:=(__)+(((___)))//(____)-((___))+((___)**(___)**((_______)))
, _________________ := ((((((((((((((_________________))))))))))))))+_______
, ((_________________),~_______________________)] for Invar in range(__) if ((_______)) !=[(([]==[]))-(___)]]][___]: Invar = 5, eval(type(None).__bool__.__doc__)()
xz=globals()
xy=map(lambda n : {v: k for k,v in globals().items() if not isinstance(v,dict)}[n],[68,16,16,5,4,0])```
is my code
cannot assign to lambda is my error
top line highlighted
whats the issue here?
lambda ...: [...] = ...
you cannot assign to lambda
have you ever written in python?
idk how lambdas work that well
i think i accidentally changed smth
when i wrote the code it was working
So you're saying:
- No keywords
- No accessing builtins by name
- (Basically: only literals and dunder methods/attributes of literals (possibly chained)?)
oops reply disappeared
.
we are making progress in dms rn
There was a similar challenge in here at some point, except the only literal allowed was ...
and no syntactic sugar was allowed except for attributes and method calls
(and arguments to method calls obviously had to be made using the same rules)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
'__custom__',
object.__class__.__class__('x', (), {
'__init__': lines = (__builtins__.__import__('sys').stdout.write(x) for i in range(2))
})
)
__custom__.__init__('hello')``` is what we have
but = is a syntax error
lines = thing is instead of lambda
use setitem for lines too
yeah
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"lines",
(__builtins__.__import__('sys').stdout.write(i) for i in range(2))
)
Perhaps?
int is an instance of type
oh
its a subclass of object
__builtins__ is variable
you cant use it
I can?
create a script using only dundermethods with no common builtin keyword and methods
you use builtin name
__builtins__ is builtin name
it's a builtin dundermethod? no
I guess we have to allow bultins since there is no other way 😂
Hey @sick hound
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"lines",
(__builtins__.__import__('sys').stdout.write(i) for i in range(2))
)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
'__custom__',
object.__class__.__class__('x', (), {
'__init__': lambda age: __builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
'age',
age
),
'__call__': x
})
)
__custom__.__init__(24)
__custom__.__call__(object)
I still don't get how we are supposed to use lines
it is not dunderattr of something
so it is not allowed, i guess
!e
print(1 .class.base.subclasses()[45])
@fleet bridge :white_check_mark: Your eval job has completed with return code 0.
<class 'module'>
We have to allow it since I cant find any other way
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
'custom',
object.class.class('x', (), {
'init': builtins.import('sys')._getframe(0).f_globals.setitem(
"lines",
(x.strip() for x in builtins.import('sys').stdin)
),
'call': builtins.import('sys').stdout.write([str(i) for i in lines])
})
)
custom.init("hi")
custom.call()
@sick hound :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 8, in <module>
003 | TypeError: write() argument must be str, not list
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
'custom',
object.class.class('x', (), {
'init': builtins.import('sys')._getframe(0).f_globals.setitem(
"lines",
(x.strip() for x in builtins.import('sys').stdin)
),
'call': builtins.import('sys').stdout.write(str([str(i) for i in lines]))
})
)
custom.init("hi")
custom.call()
@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: 'NoneType' object is not callable
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
'custom',
object.class.class('x', (), {
'init': builtins.import('sys')._getframe(0).f_globals.setitem(
"lines",
(x.strip() for x in builtins.import('sys').stdin)
),
'call': builtins.import('sys').stdout.write(str([str(i) for i in lines]))
})
)
custom.init("hi")
custom.call
@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: 'NoneType' object is not callable
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
'custom',
object.class.class('x', (), {
'init': builtins.import('sys')._getframe(0).f_globals.setitem(
"lines",
(x.strip() for x in builtins.import('sys').stdin)
),
'call': builtins.import('sys').stdout.write(str([str(i) for i in lines]))
})
)
custom.init("hi")
custom.call()
@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: 'NoneType' object is not callable
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
'custom',
object.class.class('x', (), {
'init': builtins.import('sys')._getframe(0).f_globals.setitem(
"lines",
(x.strip() for x in builtins.import('sys').stdin)
),
'call': builtins.import('sys').stdout.write(str([str(i) for i in lines]))
})
)
custom.init
custom.call
@sick hound :white_check_mark: Your eval job has completed with return code 0.
[]
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
'custom',
object.class.class('x', (), {
'init': builtins.import('sys')._getframe(0).f_globals.setitem(
"lines",
(x.strip() for x in builtins.import('sys').stdin)
),
'call': builtins.import('sys').stdout.write(str([str(i) for i in lines]))
})
)
custom.init
custom.call("hi")
@sick hound :x: Your eval job has completed with return code 1.
001 | []Traceback (most recent call last):
002 | File "<string>", line 13, in <module>
003 | TypeError: 'int' object is not callable
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
'custom',
object.class.class('x', (), {
'init': builtins.import('sys')._getframe(0).f_globals.setitem(
"lines",
(x.strip() for x in builtins.import('sys').stdin)
),
'call': builtins.import('sys').stdout.write(str([str(i) for i in lines]))
})
)
custom.init
custom.call(123)
@sick hound :x: Your eval job has completed with return code 1.
001 | []Traceback (most recent call last):
002 | File "<string>", line 13, in <module>
003 | TypeError: 'int' object is not callable
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
'custom',
object.class.class('x', (), {
'init': builtins.import('sys')._getframe(0).f_globals.setitem(
"lines",
(x.strip() for x in builtins.import('sys').stdin)
),
'call': builtins.import('sys').stdout.write(str([str(i) for i in lines]))
})
)
custom.init
custom.call(["hi", "hi"])
@sick hound :x: Your eval job has completed with return code 1.
001 | []Traceback (most recent call last):
002 | File "<string>", line 13, in <module>
003 | TypeError: 'int' object is not callable
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
'custom',
object.class.class('x', (), {
'init': builtins.import('sys')._getframe(0).f_globals.setitem(
"lines",
(x.strip() for x in builtins.import('sys').stdin)
),
'call': builtins.import('sys').stdout.write(str([str(i) for i in lines]))
})
)
custom.init
custom.call()
@sick hound :x: Your eval job has completed with return code 1.
001 | []Traceback (most recent call last):
002 | File "<string>", line 13, in <module>
003 | TypeError: 'int' object is not callable
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
'custom',
object.class.class('x', (), {
'init': builtins.import('sys')._getframe(0).f_globals.setitem(
"lines",
(x.strip() for x in builtins.import('sys').stdin)
),
'call': builtins.import('sys').stdout.write(str([str(i) for i in lines]))
})
)
custom.init
custom.call
@sick hound :white_check_mark: Your eval job has completed with return code 0.
[]
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
'custom',
object.class.class('x', (), {
'init': builtins.import('sys')._getframe(0).f_globals.setitem(
"lines",
(x.strip() for x in builtins.import('sys').stdin)
),
'call': builtins.import('sys').stdout.write(str([str(i) for i in lines]))
})
)
custom.init
custom.call
@sick hound :white_check_mark: Your eval job has completed with return code 0.
[]
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
'custom',
object.class.class('x', (), {
'init': builtins.import('sys')._getframe(0).f_globals.setitem(
"lines",
(x.strip() for x in builtins.import('sys').stdin)
),
'call': lines: builtins.import('sys').stdout.write(str([str(i) for i in lines]))
})
)
custom.init
custom.call
@sick hound :x: Your eval job has completed with return code 1.
001 | File "<string>", line 8
002 | '__call__': lines: __builtins__.__import__('sys').stdout.write(str([str(i) for i in lines]))
003 | ^
004 | SyntaxError: invalid syntax
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
'custom',
object.class.class('x', (), {
'init': builtins.import('sys')._getframe(0).f_globals.setitem(
"lines",
(x.strip() for x in builtins.import('sys').stdin)
),
'call': builtins.import('sys').stdout.write(str([str(i) for i in lines]))
})
)
custom.init
custom.call
@sick hound :white_check_mark: Your eval job has completed with return code 0.
[]
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
'custom',
object.class.class('x', (), {
'init': builtins.import('sys')._getframe(0).f_globals.setitem(
"lines",
(x.strip() for x in builtins.import('sys').stdin)
),
'call': builtins.import('sys').stdout.write(str(i for i in lines))
})
)
custom.init
custom.call
@sick hound :white_check_mark: Your eval job has completed with return code 0.
<generator object <genexpr> at 0x7f0050f73d10>
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
'custom',
object.class.class('x', (), {
'init': builtins.import('sys')._getframe(0).f_globals.setitem(
"lines",
(x.strip() for x in builtins.import('sys').stdin)
),
'call': builtins.import('sys').stdout.write(str(i for i in lines))
})
)
custom.init("hi")
custom.call
@sick hound :x: Your eval job has completed with return code 1.
001 | <generator object <genexpr> at 0x7f98b14abd10>Traceback (most recent call last):
002 | File "<string>", line 12, in <module>
003 | TypeError: 'NoneType' object is not callable
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
'custom',
object.class.class('x', (), {
'init': builtins.import('sys')._getframe(0).f_globals.setitem(
"lines",
(x.strip() for x in builtins.import('sys').stdin)
),
'call': builtins.import('sys').stdout.write(str(i for i in lines))
})
)
custom.init
custom.call("hi")
@sick hound :x: Your eval job has completed with return code 1.
001 | <generator object <genexpr> at 0x7efd3b04bd10>Traceback (most recent call last):
002 | File "<string>", line 13, in <module>
003 | TypeError: 'int' object is not callable
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
'custom',
object.class.class('x', (), {
'init': builtins.import('sys')._getframe(0).f_globals.setitem(
"lines",
(x.strip() for x in builtins.import('sys').stdin)
),
'call': builtins.import('sys').stdout.write(str(i for i in lines))
})
)
custom.init
custom.call()
@sick hound :x: Your eval job has completed with return code 1.
001 | <generator object <genexpr> at 0x7f325c797d10>Traceback (most recent call last):
002 | File "<string>", line 13, in <module>
003 | TypeError: 'int' object is not callable
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
'custom',
object.class.class('x', (), {
'init': builtins.import('sys')._getframe(0).f_globals.setitem(
"lines",
(x.strip() for x in builtins.import('sys').stdin)
),
'call': builtins.import('sys').stdout.write(str(i for i in lines))
})
)
custom.init()
custom.call()
@sick hound :x: Your eval job has completed with return code 1.
001 | <generator object <genexpr> at 0x7f6c547cbd10>Traceback (most recent call last):
002 | File "<string>", line 12, in <module>
003 | TypeError: 'NoneType' object is not callable
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
'custom',
object.class.class('x', (), {
'init': builtins.import('sys')._getframe(0).f_globals.setitem(
"lines",
(x.strip() for x in builtins.import('sys').stdin)
),
'call': builtins.import('sys').stdout.write(str(i for i in lines))
})
)
custom.init
custom.call
@sick hound :white_check_mark: Your eval job has completed with return code 0.
<generator object <genexpr> at 0x7fe5cca47d10>
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
'custom',
object.class.class('x', (), {
'init': builtins.import('sys')._getframe(0).f_globals.setitem(
"lines",
(x.strip() for x in builtins.import('sys').stdin)
),
'call': str([i for i in builtins.import('sys').stdout.write(str(i for i in lines))])
})
)
custom.init
custom.call
@sick hound :x: Your eval job has completed with return code 1.
001 | <generator object <genexpr> at 0x7fbb01733d80>Traceback (most recent call last):
002 | File "<string>", line 8, in <module>
003 | TypeError: 'int' object is not iterable
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
'custom',
object.class.class('x', (), {
'init': builtins.import('sys')._getframe(0).f_globals.setitem(
"lines",
(x.strip() for x in builtins.import('sys').stdin)
),
'call': builtins.import('sys').stdout.write(str(i for i in lines))
})
)
custom.init
custom.call
@sick hound :white_check_mark: Your eval job has completed with return code 0.
<generator object <genexpr> at 0x7f3febd6bd10>
str is not a dunder
Ik I have to cheat a little atm
object isn't either
I need to get the code to work first before trying to replace those stuff
are you allowing comprehensions?
!e
_ = None .__class__.__base__.__subclasses__()
builtins = _[100].__init__.__class__(_[100].__init__.__code__.replace(
co_argcount=0,
co_posonlyargcount=0,
co_kwonlyargcount=0,
co_nlocals=0,
co_stacksize=2,
co_flags=64,
co_firstlineno=1,
co_code=_[6]((101, 0, 100, 0, 131, 1, 83, 0)),
co_consts=('builtins',),
co_names=('__import__',),
co_varnames=(),
co_freevars=(),
co_cellvars=(),
co_filename='<file>',
co_name='<module>',
co_linetable=_[6]((8, 0)),
),{},'')()
print(builtins)
@fleet bridge :white_check_mark: Your eval job has completed with return code 0.
<module 'builtins' (built-in)>
wow
now you have builtins module honestly obtained
all string literals can be constructed from class names
int literals can be constructed from booleans: 2 == ([]==[])+([]==[]), but this is boring
is lambdas allowed?
Int literals can be constructed by slicing bytes objects, too
!e
_ = ().__class__.__base__.__subclasses__()
assert _[0] is type
assert _[2] is int
assert _[4] is bytearray
assert _[6] is bytes
assert _[12] is classmethod
assert _[14] is complex
assert _[26] is dict
# assert _[27] is ellipsis
assert _[28] is enumerate
assert _[29] is float
assert _[31] is frozenset
# assert _[32] is function
assert _[38] is list
assert _[41] is memoryview
assert _[48] is property
assert _[50] is range
assert _[51] is reversed
assert _[55] is set
assert _[56] is slice
assert _[57] is staticmethod
assert _[59] is super
assert _[62] is tuple
assert _[64] is str
# assert _[76] is NoneType
# assert _[77] is NotImplementedType
assert _[85] is BaseException
assert _[97] is filter
assert _[98] is map
assert _[99] is zip
type = _[0]
int = _[2]
bytearray = _[4]
bytes = _[6]
classmethod = _[12]
complex = _[14]
dict = _[26]
ellipsis = _[27]
enumerate = _[28]
float = _[29]
frozenset = _[31]
function = _[32]
list = _[38]
memoryview = _[41]
property = _[48]
range = _[50]
reversed = _[51]
set = _[55]
slice = _[56]
staticmethod = _[57]
super = _[59]
tuple = _[62]
str = _[64]
NoneType = _[76]
NotImplementedType = _[77]
BaseException = _[85]
filter = _[97]
map = _[98]
zip = _[99]
@fleet bridge :warning: Your eval job has completed with return code 0.
[No output]
it works
it is a lot of builtin classes
!e
_ = ().__class__.__base__.__subclasses__()
eval = _[100].__init__.__class__(
_[100].__init__.__code__.replace(
co_argcount=0,
co_posonlyargcount=0,
co_kwonlyargcount=0,
co_nlocals=0,
co_stacksize=1,
co_flags=64,
co_code=_[6]((101, 0, 83, 0)),
co_consts=(),
co_names=('eval',),
co_varnames=(),
co_freevars=(),
co_cellvars=(),
co_filename='<file>',
co_name='<module>',
co_firstlineno=1,
co_linetable=_[6]((4, 0)),
),
{},
'',
)()
print(eval)
print(eval('__builtins__'))
@fleet bridge :white_check_mark: Your eval job has completed with return code 0.
001 | <built-in function eval>
002 | <module 'builtins' (built-in)>
!e
_ = ().__class__.__base__.__subclasses__()
print(
*[
f'{i:3} {x.__name__:30} {["C", "Py"][x.__init__.__class__.__name__ == "function"]}'
for i, x in enumerate(_)
],
sep='\n',
)
@fleet bridge :white_check_mark: Your eval job has completed with return code 0.
001 | 0 type C
002 | 1 async_generator C
003 | 2 int C
004 | 3 bytearray_iterator C
005 | 4 bytearray C
006 | 5 bytes_iterator C
007 | 6 bytes C
008 | 7 builtin_function_or_method C
009 | 8 callable_iterator C
010 | 9 PyCapsule C
011 | 10 cell C
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/akofisuxag.txt?noredirect
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
'custom',
object.class.class('x', (), {
'init': builtins.import('sys')._getframe(0).f_globals.setitem(
"lines",
(x.strip() for x in builtins.import('sys').stdin)
),
'call': builtins.import('sys').stdout.write([str(i) for i in lines])
})
)
custom.init("hi")
custom.call()```
@sick hound :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 8, in <module>
003 | TypeError: write() argument must be str, not list
!e
().__class__.__base__.__subclasses__()[100].__init__.__class__(
().__class__.__base__.__subclasses__()[100].__init__.__code__.replace(
co_argcount=0,
co_posonlyargcount=0,
co_kwonlyargcount=0,
co_nlocals=0,
co_stacksize=1,
co_flags=64,
co_code=().__class__.__base__.__subclasses__()[6]((101, 0, 83, 0)),
co_consts=(),
co_names=('eval',),
co_varnames=(),
co_freevars=(),
co_cellvars=(),
co_filename='<file>',
co_name='<module>',
co_firstlineno=1,
co_linetable=().__class__.__base__.__subclasses__()[6]((4, 0)),
),
{},
'',
)()('print("Hello World!")')
@fleet bridge :white_check_mark: Your eval job has completed with return code 0.
Hello World!
that does not look like python code lmao
nothing here does
this is the error im trying to fix
tryna get the value of self to 0 but manually its not working and making a variable to index 0 is super brain damaging because of lambda syntax
prints true instead of false
!e
(lambda:()).__class__((lambda:()).__code__.replace(co_argcount=[]==(),co_posonlyargcount=[]==(),co_kwonlyargcount=[]==(),co_nlocals=[]==(),co_stacksize=[]==[],co_flags=([]==[])<<(((([]==[])+([]==[]))**(([]==[])+([]==[])+([]==[])))),co_code=(lambda:()).__code__.co_code.__class__(((((([]==[])+([]==[]))**(([]==[])+([]==[])+([]==[])))+([]==[])+([]==[]))**(([]==[])+([]==[]))+([]==[]),[]==(),(((([]==[])+([]==[]))**(([]==[])+([]==[])+([]==[])))+([]==[]))**(([]==[])+([]==[]))+([]==[])+([]==[]),[]==())),co_consts=(),co_names=('eval',),co_varnames=(),co_freevars=(),co_cellvars=(),co_filename='',co_name='',co_firstlineno=[]==[],co_linetable=(lambda:()).__code__.co_code.__class__((([]==[])<<([]==[])+([]==[]),[]==())),),{},'',)()('print("Hello World!")')
@fleet bridge :white_check_mark: Your eval job has completed with return code 0.
Hello World!
ez
@fleet bridge i challenge you to make the most complex False keyword there is
im still making mine
it will be like a race xd
not[()]
no: TypeError: bad operand type for unary ~: 'list'
!e
false = (lambda:()).__class__((lambda:()).__code__.replace(co_argcount=[]==(),co_posonlyargcount=[]==(),co_kwonlyargcount=[]==(),co_nlocals=[]==(),co_stacksize=[]==[],co_flags=([]==[])<<(((([]==[])+([]==[]))*(([]==[])+([]==[])+([]==[])))),co_code=(lambda:()).__code__.co_code.__class__(((((([]==[])+([]==[]))**(([]==[])+([]==[])+([]==[])))+([]==[])+([]==[]))**(([]==[])+([]==[]))+([]==[]),[]==(),(((([]==[])+([]==[]))**(([]==[])+([]==[])+([]==[])))+([]==[]))**(([]==[])+([]==[]))+([]==[])+([]==[]),[]==())),co_consts=(),co_names=((()==()).__and__.__doc__[(([]==[])+([]==[]))**(([]==[])+([]==[]))**(([]==[])+([]==[]))]+(()==()).__and__.__doc__[(([]==[])+([]==[]))*(([]==[])+([]==[]))*(([]==[])+([]==[])+([]==[])):(([]==[])+([]==[]))**(([]==[])+([]==[]))**(([]==[])+([]==[]))-([]==[])],),co_varnames=(),co_freevars=(),co_cellvars=(),co_filename=(lambda:()).__code__.co_filename,co_name=(lambda:()).__code__.co_name,co_firstlineno=[]==[],co_linetable=(lambda:()).__code__.co_code.__class__((([]==[])<<([]==[])+([]==[]),[]==())),),{},(lambda:()).__code__.co_name,)()(([]==()).__class__.__doc__[(([]==[])<<(((([]==[])+([]==[]))*(([]==[])+([]==[])+([]==[])))))-([]==[])-([]==[])-([]==[])-([]==[])-([]==[]):([]==[])<<(((([]==[])+([]==[]))*(([]==[])+([]==[])+([]==[]))))])
print(false)
@fleet bridge :white_check_mark: Your eval job has completed with return code 0.
False
@fleet bridge how… how do u know all this?
tough to beat
but uh
il beat it
fucking wait and il do it
il rename every single keyword i use into something which looks like a magic method then make a large boolean statement from all the keywords and functions containing them which prints out false
oh i forgot turning the chr into binary and back
because why not
i see what you did there
😉
good old replace making everything brain damaging oh and dont forget lambda
you cannot greatly simplify this using only tuple, list and lambda literals
simply by making more readable
i have yet to try this
it seems fun
hmm
check this out
most complex way to use boolean keywords
i have yet to work on it
this is what i got rn
!e ```py
class a():
def init(self,variable1,variable2):
self.a = variable1
self.b = variable2
def thing(self,variable1,variable2):
self.variable1 = variable1
self.variable2 = variable2
b = a(4,5)
try:
a.thing(a,4,5)
except:
print("Error occured on a")
try:
b.thing(a,4,5)
except:
print("Error occured on b")
try:
a.thing(4,5)
except:
print("error occured on second a")
try:
b.thing(4,5)
except:
print("error occured on second b")
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | Error occured on b
002 | error occured on second a
yea, this is it
@sick hound :white_check_mark: Your eval job has completed with return code 0.
False
might allow for v funni obfusication
mostly the fact you have to say that you're using a on 1 and not on the other. i understand why but its just something ive never noticed before
i have an idea
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
'__custom__',
object.__class__.__class__('x', (), {
'__init__': __builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"lines",
(x.strip() for x in __builtins__.__import__('sys').stdin)
),
'__call__': __builtins__.__import__('sys').stdout.write(str(i for i in lines))
})
)
__custom__.__init__
__custom__.__call__
<generator object <genexpr> at 0x000001CB2A751E00>
I'm trying to recreate lambda but for some reason when I try to call __init__ and __call__ it throws an error saying an int object is not callable. How would I go on about this? I need to let __init__ accept arguments, tried to do that using sys.stdin
Ping me on reply
how tf do we let __init take args
No clue 🤷
We need it to act like a real class
idk could we add parenthesis?
maybe
also btw change the strip command
Nope, it throws an object not callable error
to smth else
weird
I tried all ways of the article you sent, nothing works 🤷
shits hard man
could that mean __int__ acts like object
Maybe, but I don't understand why it even says int object
same
super strange
idk we should go through it step by step with someone
and figure it out
it prints <generator object <genexpr> at 0x000001CB2A751E00>
this is what happens when u try print a lambda or generator
or something along those lines
yeah but I looped through lines which is a generator?
oh yeah true
The “TypeError: 'int' object is not callable” error is raised when you try to call an integer. This can happen if you forget to include a mathematical operator in a calculation. This error can also occur if you accidentally override a built-in function that you use later in your code, like round() or sum() .13 Aug 2020
The last explanation might actually be valid in this case 👀
accidentally override a built in function
yep
Hmm but where do we override it?
object.__class__.__class__('x', (), {
'__init__': ``` possibly
i think we just need to google more and dig more until we can find an alternative
maybe a named list comp
lol
isn't that what we are already doing?
nvm yeah
uhh this is hard
but it will be worth it
I hope so xD
I've asked in 5 different servers
No one knows 
hopefully a knowledge guy will see us and come up with something
Yeah
!e ```py
class ():
def init(self):
self.=(([]==[])-([]==[]))
,,______=(),(),[]
=lambda _,:(==__)
for ______ in [(,__),(,__),(,__),(,)]:
=lambda _,:(.+([]==[]),[._+(([]==[])+([]==[])) if .%(([]==[])+([]==[]))!=(([]==[])-([]==[])) else . for ___ in [([]==[])]][(([]==[])-([]==[]))])
_______=(([(([]==[])-([]==[]))],[([]==[])]))
_____.append((([(([]==[])-([]==[]))],[([]==[])])))
.,__.=[(([]==[])-([]==[]))],[([]==[])]
print((.pop((([]==[])-([]==[]))))+(.pop((([]==[])-([]==[])))))```
@sick hound :white_check_mark: Your eval job has completed with return code 0.
1
@sick hound wrote this and i inspired him
im proud
!e smh just do this... ```py
print(1)
🤦lol
@sick hound :white_check_mark: Your eval job has completed with return code 0.
1
its not finished yet ):
xD
oh my god
!e py (__) = lambda ((_)):=((_)) + ([]==[])+([]==[])-([]==[]) print((__)(4))
@sick hound :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | (__) = lambda ((_)):=((_)) + ([]==[])+([]==[])-([]==[])
003 | ^
004 | SyntaxError: invalid syntax
ffs
hey this is cool
the virgin
___________ = ([]==[])-([]==[])
vs the chad
class ____():
def __init__(self):
self._=(([]==[])-([]==[]))
_,__,________=____(),____(),[]
___=lambda _,__:(_==__)
for ______ in [(_,__),(_,__),(_,__),(_,__)]:
_____=lambda _,__:(_._+([]==[]),[__._+(([]==[])+([]==[])) if _._%(([]==[])+([]==[]))!=(([]==[])-([]==[])) else __._ for ___ in [([]==[])]][(([]==[])-([]==[]))])
_______=(_____(______[(([]==[])-([]==[]))],______[([]==[])]))
________.append((___(_______[(([]==[])-([]==[]))],_______[([]==[])])))
_._,__._=_______[(([]==[])-([]==[]))],_______[([]==[])]
print(f"{int((________.pop((([]==[])-([]==[])))))}")
@sick hound heh
i could probably make this better but rn this is cool
wanna work together and make a second class
to print 0
and make binary crap
Hey @sick hound!
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:
Hey @sick hound!
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:
ffs
rip
this is my code
it prints _______________________``
it prints this
False
True
_______________________ ____ ____ _______ __
False
True
_______________________ ____ ____ _______ __```
i only want it to print False and True
i cant spot why it prints the underscores
if someone can help woud be appreciated
oooh i have funny idea
we find list of python challenges
yes
..
one of us writes code to solve the first one, then the next person tries to rewrite the code to solve the next challenge while changing/adding/deleting as little as possible
eventually code will become so weird it'll legally be esoteric
i can try that
later today
in an hour?
ok
hmmm
lets go for it
send the challenges
@sick hound
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
'__custom__',
object.__class__.__class__('x', (), {
'__init__': __builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"lines",
(x.strip() for x in __builtins__.__import__('sys').stdin)
),
'__call__': __builtins__.__import__('sys').stdout.write(str(i for i in lines))
})
)
__custom__.__init__
__custom__.__call__```
how can we add attributes to __init__
will in a second
__getattr__(self, name) Is called when the accessing attribute of a class that does not exist.
__setattr__(self, name, value) Is called when assigning a value to the attribute of a class.
__delattr__(self, name)```
@sick hound maybe these will solve our issue
Yeah but then we'd have to implement everything differently, we could do that but idk how that route works
the issue we have rn is that we know how to implement a class using dunder methods and such, but we don't know how to make a function..
idk how we can do that
we ned
need to research that
I know u can make an empty function and then assign code to it
@novel scarab
our challenge is to not using any commonly used methods, keywords and opperators
Could you show us
lets see
empty function pog
it's with the compile
thing
so u define function
def foo(): pass
and then you can do
foo.__code__ = compile('print("hello world")', "<string>", "exec")
iirc
list3 = []
list4 = []
word5 = str()
list2 = [[[[], []], [[]], [[], [], [], [], []]], [[[], []], [[]], [[], []]], [[[], []], [[]], [[], [], [], [], [], [], [], [], []]], [[[], []], [[]], [[], [], [], [], [], [], [], [], []]], [[[], []], [[], []], [[], []]], [[[], [], [], []], [[], [], []]], [[[], []], [[], []], [[], [], [], [], [], [], [], [], [], []]], [[[], []], [[], []], [[], []]], [[[], []], [[], []], [[], [], [], [], []]], [[[], []], [[]], [[], [], [], [], [], [], [], [], []]], [[[], []], [[]], [[]]]]
for character in list2:
for digit in character:
valueOfDigit = len(digit)-([]==[])
list3.append(str(valueOfDigit))
list4.append(str().join(list3))
list3 = []
for n in list4:
word5+=chr(int(n))
print(word5)
not that estoric, but this prints hello world without numbers or strings
ig the next step would be to do it without lists
actually that'd be incredibly easy
You mean without number nor string literals
yes
how can we define it without def
or is it not possible
idk
A lambda
like how we made a class using lambda in bot commands yesterday
lambda is a common keyword
we are trying to make one ourselves
Oh
you are using for in your code
you could use a class?
we will change that @novel scarab
dw
and we could keep it ig
Wait so what are the restrictions?
Nope type wont work
well it works for creating a class, I don't think we can create a function though
If everything is an object in Python we should be able to create a function object somehow, right?
Yup
I have no idea how though
you might be possible to change something like __init__ of a class, and create said class using type. therefore bypassing def.
not sure tho
Replace with what
().__class__.__class__("", (), {})
#or
str.__class__("", (), {})
Creates a class
shouldn't there be __func__?
types.FunctionType ?
can't use types
oh
we avoid using the type() method too, hence ().__class__.__class__()
It does the same thing tho
Hmm what do you mean?
(lambda x:x).__class__
We can't use lambda
We are trying to make them
That's what the whole thing is about 😂
the whole challenge
!e ```py
().class.class("Myclass", (), {
"init": lambda x: print(x)
})
Myclass.init("hi")
@sick hound :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 5, in <module>
003 | NameError: name 'Myclass' is not defined
hmm
class b():
pass
thing2 = b.__init__
it might be possible to modify thing2 so it does something else
!e ```py
().class.class("Myclass", (), {
"init": lambda x: print(x)
})
init("hi")
@sick hound :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 5, in <module>
003 | NameError: name '__init__' is not defined
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"custom",
object.class.class("class", (), {
"init": lambda x: print(x)
})
)
custom.init("hi")
@sick hound :white_check_mark: Your eval job has completed with return code 0.
hi
Are we allowed to use the return keyword
probably using __code__
yes but only return
Classes can't return iirc
How do you inherit using the golfed way?
🤷
we just need to get rid of lambda
I imagine we can return something if we inherit some built-in
and replace
Maybe eval
lambda isnt required in that code example
we can return eval
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
None: print("hi")
})
)
method()
@sick hound :white_check_mark: Your eval job has completed with return code 0.
hi
guys
My God
oh
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
None: print("hi")
})
)
method
@sick hound :white_check_mark: Your eval job has completed with return code 0.
hi
why dont you just use "print"
hmm
Lol
print common keyword
lmao
print isnt a keyword, is a function
still bad
"__init__": print
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"x": print(x)
})
)
method."hello"
@sick hound :x: Your eval job has completed with return code 1.
001 | File "<string>", line 7
002 | method."hello"
003 | ^^^^^^^
004 | SyntaxError: invalid syntax
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"x": print(x)
})
)
method.lol
@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 | NameError: name 'x' is not defined
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"x": print("hi")
})
)
method
@sick hound :white_check_mark: Your eval job has completed with return code 0.
hi
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"x": print("hi")
})
)
method.x
@sick hound :white_check_mark: Your eval job has completed with return code 0.
hi
now this works
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"x": print("x"),
"y": print("y")
})
)
method.x
method.y
method
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | x
002 | y
!e py __builtins__.__import__('sys')._getframe(0).f_globals.__setitem__( "method", object.__class__.__class__("method", (), { "x": print("hi") }) ) x()
@sick hound :x: Your eval job has completed with return code 1.
001 | hi
002 | Traceback (most recent call last):
003 | File "<string>", line 7, in <module>
004 | NameError: name 'x' is not defined
We're trying to make lambdas
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"x": print("x"),
"y": print("y")
})
)
method.x
method.y
ik
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | x
002 | y
!e __builtins__.__import__('sys')._getframe(0).f_globals.__setitem__( "method", object.__class__.__class__("method", (), { "x": stdout.write("hi") }) ) method.x
@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 | NameError: name 'stdout' is not defined
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"x": builtins.import('sys').stdout.write("x"),
"y": builtins.import('sys').stdout.write("y")
})
)
method.x
method.y
@sick hound :white_check_mark: Your eval job has completed with return code 0.
xy
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"x": builtins.import('sys').stdout.write("x\n"),
"y": builtins.import('sys').stdout.write("y\n")
})
)
method.x
method.y
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | x
002 | y
pog
So if we can create attributes?
We can use them, but we need it to take in arguments
How would that work?
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"x()": builtins.import('sys').stdout.write("x\n"),
"y()": builtins.import('sys').stdout.write("y\n")
})
)
method.x
method.y
@sick hound :x: Your eval job has completed with return code 1.
001 | x
002 | y
003 | Traceback (most recent call last):
004 | File "<string>", line 8, in <module>
005 | AttributeError: type object 'method' has no attribute 'x'
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"x()": builtins.import('sys').stdout.write("x\n"),
"y()": builtins.import('sys').stdout.write("y\n")
})
)
method.x()
method.y()
@sick hound :x: Your eval job has completed with return code 1.
001 | x
002 | y
003 | Traceback (most recent call last):
004 | File "<string>", line 8, in <module>
005 | AttributeError: type object 'method' has no attribute 'x'
__import__('sys')._getframe(0).f_globals.update({"say": type("sayer", tuple(), {"__init__": print })})
say("hi")
Try that
i'm not sure why just saying fn = type("say", tuple(), {"init": ... }) isnt good enough
__import__('sys')._getframe(0).f_globals.update({"say": type("sayer", tuple(), {"__init__": print })})("Hello World")
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"x": print,
"y": print
})
)
method.x
method.y
@sick hound :warning: Your eval job has completed with return code 0.
[No output]
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"x": print,
"y": print
})
)
method.x("hi")
method.y
@sick hound :white_check_mark: Your eval job has completed with return code 0.
hi
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"x": print,
"y": print
})
)
method.x("hi")
method.y("lol")
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | hi
002 | lol
Yoooooo
Wait
Hold on
we are making progress
Is there an alternative to print?
yeah
stdout.write
lambda is very not that often required, python programmers dramatically overuse it
i think
its fun tho
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"x": builtins.import('sys').stdout.write(),
"y": print
})
)
method.x("hi")
method.y("lol")
@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: TextIOWrapper.write() takes exactly one argument (0 given)
eg., map(str.split, ...)
Nope
it's used in a lot of cases
i dont mean it isnt required in the sense that "just use a for loop"
rip
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"x": builtins.import('sys').stdout.write(str()),
"y": print
})
)
method.x("hi")
method.y("lol")
@sick hound :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 8, in <module>
003 | TypeError: 'int' object is not callable
i mean its literally not required for funcitonal programming in python
!e
testing = type("testing", (), {None: 1})
print(testing)
testing + 1
try getattr
take this @sick hound
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"x": print,
"y": print
})
)
method.x("hi")
method.y("lol")
print(type(print))
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | hi
002 | lol
003 | <class 'builtin_function_or_method'>
lets see what we get from there
hmm so
sys.stdout.write()```
wont work
that's exactly what we tried
try os.write
!e ```py
print(type(print))
@sick hound :white_check_mark: Your eval job has completed with return code 0.
<class 'builtin_function_or_method'>
wait
What does this mean?
os.write
weird
type could work
print('Hello, World!')
(f:=open(1,'wb',0)).write(b'Hello, World!\n')
import os, sys, io;os.write(1, b'Hello, World!\n')
sys.stdout.write('Hello, World!\n')
sys.stderr.write('Hello, World!\n')
i=sys.stdin;sys.stdin=io.StringIO('\n');input('Hello, World!\n');sys.stdin=i
import pprint;pprint.pp(t:=type('',(),{'__repr__':lambda s:'Hello, World!'})())
pprint.pprint(t)
exec(c:=compile('t', '', 'single'))
(l:=lambda:0).__code__ = c;l()
l.__code__ = (l:=lambda:t).__code__.replace(co_code=b't\x00F\x00d\x00S\x00');l()
eval('print("Hello, World!")')
import code;code.interact('Hello, World!',lambda i:(()for()in()).throw(EOFError),{},'')
code.InteractiveInterpreter({}).write('Hello, World!\n')
code.InteractiveConsole({}).write('Hello, World!\n')
exit('Hello, World!')
any of these might work
(f:=open(1,'wb',0)).write(b'Hello, World!\n')```
globals()['say'] = type("sayer", tuple(), {"__init__": print})
this works
maybe theres an alternative to globals?
what more are you after?
We already have that
ah theres print
oh mb yeah we do
what's the goal?
__builtins__.__import__('sys')._getframe(0).f_globals
I think
yes this i forgor
yeah
?
(f:=open(1,'wb',0)).write(b'Hello, World!\n')```
code.InteractiveConsole({}).write('Hello, World!\n')```
recreate lambda with every possible human restriction
!e ```py
print(type(print))
If someone can tell me what the bellow output means and what I can do with such information, I can create my own ``print``
@sick hound :white_check_mark: Your eval job has completed with return code 0.
<class 'builtin_function_or_method'>
you cant do anything with builtins
python has lots of callable()s, functions, builtins, methods, etc.
it's showing that print is a class, bcs objects and stuff, thats also a builtin function or method
fairly obvious...
Yes but what can I do with 'builtin_function_or_method'
you want to create your own print function in a single-line of python code, without using print or lambda?
nothing
is that the goal?
ah alright
no we are trying to recreate lambda
their own version of lambda
what would "your own version of lambda" do?
you're trying to make def a function?
eg., define(name, args, code)
our own
lambda
thing with the function of a lambda
variable with lambda functionality
lambda constructs a code frame, you'd need to use someething eval-like
lambda and def are quoting code, ie., they are transforming it into an AST
iirc, python has an ast module, inspect module, and others ... you could probably put them together
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"custom",
object.class.class("class", (), {
"init": method.take_argument
})
)
custom.init("hello")
@sick hound :white_check_mark: Your eval job has completed with return code 0.
hello
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": return
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"custom",
object.class.class("class", (), {
"init": print(method.take_argument)
})
)
custom.init("hello")
@sick hound :x: Your eval job has completed with return code 1.
001 | File "<string>", line 4
002 | "take_argument": return
003 | ^^^^^^
004 | SyntaxError: invalid syntax
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"custom",
object.class.class("class", (), {
"init": method.take_argument
})
)
custom.init
@sick hound :warning: Your eval job has completed with return code 0.
[No output]
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"custom",
object.class.class("class", (), {
"init": builtins.import('sys')._getframe(0).f_globals.setitem(
"arg1",
method.take_argument
),
builtins.import('sys').stdout.flush()
})
)
custom.init("hello")
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | [H[J
002 | hello
there's no way of replacing the syntacitical use of lambda (def, ...) as they operate on syntax, not values
unless you use eval, or python provides an eval-like
constructing a function requires a code object, there's no way of constructing code objects without just quoting code, eg., "return x"
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"custom",
object.class.class("class", (), {
"init": builtins.import('sys')._getframe(0).f_globals.setitem(
"arg1",
method.take_argument
),
builtins.import('sys').stdout.flush()
})
)
custom.init("hello")
@sick hound :x: Your eval job has completed with return code 1.
001 | File "<string>", line 15
002 | __builtins__.__import__('sys').stdout.flush()
003 | ^
004 | SyntaxError: ':' expected after dictionary key
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"custom",
object.class.class("class", (), {
"init": builtins.import('sys')._getframe(0).f_globals.setitem(
"arg1",
method.take_argument
),
None: builtins.import('sys').stdout.flush()
})
)
custom.init("hello")
@sick hound :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 19, in <module>
003 | TypeError: 'NoneType' object is not callable
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"custom",
object.class.class("class", (), {
"init": builtins.import('sys')._getframe(0).f_globals.setitem(
"arg1",
method.take_argument
),
"init": builtins.import('sys').stdout.flush()
})
)
custom.init("hello")
@sick hound :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 19, in <module>
003 | TypeError: 'NoneType' object is not callable
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"custom",
object.class.class("class", (), {
"init": builtins.import('sys')._getframe(0).f_globals.setitem(
"arg1",
method.take_argument
),
"x": builtins.import('sys').stdout.flush()
})
)
custom.init("hello")
custom.x
@sick hound :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 19, in <module>
003 | TypeError: 'NoneType' object is not callable
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"custom",
object.class.class("class", (), {
"init": builtins.import('sys')._getframe(0).f_globals.setitem(
"arg1",
method.take_argument
)
#"x": builtins.import('sys').stdout.flush()
})
)
custom.init("hello")
@sick hound :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 19, in <module>
003 | TypeError: 'NoneType' object is not callable
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"custom",
object.class.class("class", (), {
"init": [method.take_argument, builtins.import('sys')._getframe(0).f_globals.setitem(
"arg1",
method.take_argument
)]
#"x": builtins.import('sys').stdout.flush()
})
)
custom.init("hello")
@sick hound :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 19, in <module>
003 | TypeError: 'list' object is not callable
progress we made? @sick hound
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"custom",
object.class.class("class", (), {
"init": method.take_argument
})
)
custom.init("hello")
@sick hound :white_check_mark: Your eval job has completed with return code 0.
hello
A lot actually
we need to find how to return
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"custom",
object.class.class("class", (), {
"init": (method.take_argument)
})
)
custom.init("hello")
@sick hound :white_check_mark: Your eval job has completed with return code 0.
hello
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"custom",
object.class.class("class", (), {
"init": (method.take_argument, "hi")
})
)
custom.init("hello")
@sick hound :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 15, in <module>
003 | TypeError: 'tuple' object is not callable
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"custom",
object.class.class("class", (), {
"init": method.take_argument
})
)
custom.init("hello")
@sick hound :white_check_mark: Your eval job has completed with return code 0.
hello
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"custom",
object.class.class("class", (), {
"init": method.take_argument; print("hi")
})
)
custom.init("hello")
@sick hound :x: Your eval job has completed with return code 1.
001 | File "<string>", line 11
002 | "__init__": __method__.take_argument; print("hi")
003 | ^
004 | SyntaxError: invalid syntax
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"custom",
object.class.class("class", (), {
"init": method.take_argument print("hi")
})
)
custom.init("hello")
@sick hound :x: Your eval job has completed with return code 1.
001 | File "<string>", line 11
002 | "__init__": __method__.take_argument print("hi")
003 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
004 | SyntaxError: invalid syntax. Perhaps you forgot a comma?
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"custom",
object.class.class("class", (), {
"init": method.take_argument, print("hi")
})
)
custom.init("hello")
@sick hound :x: Your eval job has completed with return code 1.
001 | File "<string>", line 11
002 | "__init__": __method__.take_argument, print("hi")
003 | ^
004 | SyntaxError: ':' expected after dictionary key
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"custom",
object.class.class("class", (), {
"init": method.take_argument, print("hi"): None
})
)
custom.init("hello")
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | hi
002 | hello
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"custom",
object.class.class("class", (), {
"init": method.take_argument, builtins.import('os').system("clear"): None
})
)
custom.init("hello")
@sick hound :white_check_mark: Your eval job has completed with return code 0.
hello
What I'm trying to do
print allows us to take argument
but I'm also trying to block it from actually printing something in the terminal
by clearing the terminal
that way we can store information/take arguments just like a func
and we can also do our own syntax for this use
hmmm
i'm fairly certain theres a way of doing this
Could you give an example or be a little more detailed?
globals['mynewfn'] = type(...)
globals['mynewfn_inout'] = {'args': [], 'rtn': None}
you'd then need to find a way of setting args and rtn from mynewfn
at this point you're essentially just doing what's called a tagless final embedding, or even a first embedding
What does that mean?
what you need to "make code within code" is (1) way of representing code and (2) a way of running it
if you create empty classes which represent operations, eg., class SetVariable, class PrintVaraible, etc.
then you can build a list which represents a program: [SetVariable("x", 1), PrintVariable("x"), ...] etc
you then just need to build a runner, ie., for instruction in program: ... run-instruction...
yeah
the "SetVariable" is the hard part
if you just use classes as "tokens representing operations", that's called a first embedding
a "final embedding" skips over using classes, and somehow uses native code "just to run the operation"
i think you're basically aiming at a final embedding
a first embedding is easier, a final might be possible
but either way, you do essentially have to rebuild all the basic operations of python again in your own system
eg., you're never going to be able to use return, you'll have some batshit machinery which "somehow does the same thing" in your mini universe
xD
Then, it is actually possible 😂
Has someone ever done this in python before?
The project me and @sick hound have??
not that i'm aware of, but it's common in some languages, eg., scala
idk man
some languages essentially are designed to make this the way you're supposed to program
Yeah, it would actually be a great experience doing this, I will continue this shit lmao
im back
same bro
yeah, if you take this approach, ie., re-representing primitivate operations in your own internal language system
then i suspect it will work
its really interesting
maybe me and @sick hound will make our own language
lmao
how would we do that
print takes the argument
but doesnt print
that seems giga sus idk man
a simple "final embedding" would be something like,
program = [(print, "hello"), (list, (1, 2, 3)]
[ f(x) for f, x in program ]
we clear the terminal immediately after and save information like a function
yield keyword
can we try something like that
if you run your program using a comprehension, ie., [f(x) ...for...] you may be able to pass your gloabl state as a variable
...
go on thne
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"__method__",
object.__class__.__class__("method", (), {
"take_argument": print
})
)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"setobj",
object.__class__.__class__("class", (), {
"varobj": __method__.take_argument,
"delout": __builtins__.__import__('os').system("cls")
})
)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"setvariable",
setobj.varobj
)
setvariable("hi")
If I figure out how to use setobj.delout then boom
It's almost done
print just puts it on the screen though, not in memory
yeah we can store it, but I'm not there yet, I first have to figure out how to use setobj.delout
you need function composition
i dont think there's anyhting in-built in ptyhon to do it
to be able to use setobj.delout?
you need to run two+ functions when one function runs
in some langs you can baiscally do, mycombinedfn = compose(f1, f2, f3...)
you can in python too, but you need to build compose, it isnt in the lang or libs anywhere
Oh shit
partial objects in the functools lib might work
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"setobj",
object.class.class("class", (), {
"varobj": method.take_argument
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"setvariable",
setobj.varobj
)
setvariable("hi")
builtins.import('os').system("cls")```
@sick hound :white_check_mark: Your eval job has completed with return code 0.
hi
aye nice
we got it
cool
setvariable("hi")
setvariable is our print function
done ezpz
@sick hound we can make a whole language this way
@sick hound
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"setvar",
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"varname",
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"__method__",
object.__class__.__class__("method", (), {
"take_argument": print
})
)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"setobj",
object.__class__.__class__("class", (), {
"varobj": __method__.take_argument
})
)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"setvariablename",
setobj.varobj
)
setvariablename("myvar")
__builtins__.__import__('os').system("cls")
)
__builtins__.__import__('sys')._getframe(0).g_globals.__setitem__(
"varval",
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"__method__",
object.__class__.__class__("method", (), {
"take_argument": print
})
)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"setobj",
object.__class__.__class__("class", (), {
"varobj": __method__.take_argument
})
)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"setvariablevalue",
setobj.varobj
)
setvariablevalue(50)
__builtins__.__import__('os').system("cls")
)
)
setvar
I tried doing this
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
Is the error
im gonna try make a custom return command
with an empty list which is assigned
then use yield
its a rarely used keyword
very rare
for some reason the code doesnt work at all in vscode
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"setvar",
builtins.import('sys')._getframe(0).f_globals.setitem(
"varname",
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"setobj",
object.class.class("class", (), {
"varobj": method.take_argument
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"setvariablename",
setobj.varobj
)
setvariablename("myvar")
builtins.import('os').system("cls")
)
builtins.import('sys')._getframe(0).g_globals.setitem(
"varval",
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"setobj",
object.__class__.__class__("class", (), {
"varobj": __method__.take_argument
})
)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"setvariablevalue",
setobj.varobj
)
setvariablevalue(50)
__builtins__.__import__('os').system("cls")
)
)
setvar
@sick hound :x: Your eval job has completed with return code 1.
001 | File "<string>", line 5
002 | __builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
003 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
004 | SyntaxError: invalid syntax. Perhaps you forgot a comma?
It works for me?
adding my own custom return command is gonna be so aids now
im gonna need to code through the python discord bot
😄
xD
Could someone help me with this issue tho
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"setvar",
builtins.import('sys')._getframe(0).f_globals.setitem(
"varname",
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"setobj",
object.class.class("class", (), {
"varobj": method.take_argument
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"setvariablename",
setobj.varobj
)
setvariablename("myvar")
builtins.import('os').system("cls")
)
builtins.import('sys')._getframe(0).g_globals.setitem(
"varval",
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"setobj",
object.__class__.__class__("class", (), {
"varobj": __method__.take_argument
})
)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"setvariablevalue",
setobj.varobj
)
setvariablevalue(50)
__builtins__.__import__('os').system("cls")
)
)
setvar
@sick hound :x: Your eval job has completed with return code 1.
001 | File "<string>", line 5
002 | __builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
003 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
004 | SyntaxError: invalid syntax. Perhaps you forgot a comma?
yo
put a comma after (
at __setattr__(
Wdym
The commas are all correct?
ok ffs
@sick hound run your code in Vscode
or whatever ide you use
and maybe it will say where comma should be
or what the error actually is
it gives the same error
the original code wont even work
and has 3 other "problems"
in vscode it should specify what collumn it is under the problems tab
my vscode is fucked so i cant do it
It has only one issue, and that's because you try to run cls on linux/mac, it only works in windows
do clear instead
ah
that works now
my problems tab
terminal brings up the same as the bot huh
Yeah these are pylance warnings
It still works 🤷
We might break every rule/purpose in python tho lol
i mean we will have not python at the end
Yup lmao
what do we name our language
The yield keyword in Python is used to create generators. A generator is a type of collection that produces items on-the-fly and can only be iterated once. By u...
oh uh btw this can make our own return keyword
LUP (Love Underscore Programming)
variable becomes an empty list beforehand, yield it and bam it returns
yes!
xD
thats actually epic
Ikr 😂
xD we are now language devs
will i be the youngest language dev then
thats a cool title
but until then we have to get this fucking dumbass comma error out of the way
Yeah!!
how old r u
37? i aint even 18 yet
same
sorry to break it for ya, seems like an 8 y.o broke the record
the way python reads the code theres an error, we need to add something not take away because then we would have a more detailed error message
we shall either invent time travel or indocrinate an infant
thats the ONE thing we know
Yeah lets do that in LUP lang, I heard it loves underscores xD
lets get together, be irl friends and indocrinate someone as young as possible
one of yall needs to have a child
then we really get them into python#
get together and needs to have a child sounds
7 year old language dev
bad
sussy i know lmfao
LUP best language
But the girl needs to have high IQ tho, otherwise the child will be braindead
joelang is best lang wym
whats joelang?
wym unexperienced
Dw, me and @sick hound will create our own website using a LUP web framework which you only can write in underscores 😉
hell yeah
html is garbage
ikr
my discord name is onyx
call me that
_ based language sounds fun
alright good xD
_ and ^ maybe
or pip uninstall pip
,(,),[,],{,},=,==,===,====,-,--,---,_
is what we allow
epic
no, just _ and some other character
lets only allow _ and make a py keyword since we love python, python is the lang that made LUP right
im gonna take our error to one of the help channels
joelang owns all
anything related to py we can make it a keyword in LUP
But for doing LUP we should do write it normally... otherwise it will take years and it will be a fucking pain
yo
defo
Let's fix the project we have rn, it will be a good experience
and then start on LUP
yeah
@sick hound can join
yay
after we finish this project we can legit begin work on a ton of keywords for our custom language
maybe i can make a package that can be pip installed to make it be able to run on python using the LUP syntax
omg I made JavaScript
class console:
def log(args):
print(args)
😱
lol
@sick hound
imagine if setitem took more args
That would've been much easier
wait
we maybe can manipulate it to take more args but it actually doesnt
I have an idea, hold on
ah shit nvm
the code has logical errors too
lets just solve what we need in order
logic and basic syntax -> __setitem__ error
give me a list of the logic and basic syntax and il solve that shit in vscode
hold on, if I were to know how the logic part of writing the code would look like I would've done it too, but you see where we are at rn 😂
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"setvariablevalue",
setobj.varobj
)``` here we end the bracket
we could try end the bracket for the other builtins
OH SHIT
I FUCKING SOLVED IT
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"setobj",
object.class.class("class", (), {
"varobj": method.take_argument
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"setvariablename",
setobj.varobj
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"varname",
setvariablename("myvarxx")
)
varname
@sick hound :white_check_mark: Your eval job has completed with return code 0.
myvarxx
Do u see what I did here?
This should be the logic behind it all, we now need to implement this to everything else too
im looking
YOU CLOSED BRACKETS LIKE I SAID!!!
progress
oh lol xD
!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"take_argument": print
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"setobj",
object.class.class("class", (), {
"varobj": method.take_argument
})
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"setvariablename",
setobj.varobj
)
builtins.import('sys')._getframe(0).f_globals.setitem(
"varname",
setvariablename("deez")
)
varname```
@sick hound :white_check_mark: Your eval job has completed with return code 0.
deez
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"__method__",
object.__class__.__class__("method", (), {
"take_argument": print
})
)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"setobj",
object.__class__.__class__("class", (), {
"varobj": __method__.take_argument
})
)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"setvariablename",
setobj.varobj
)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"varname",
setvariablename(VarName)
)
varname(the stuff inside here is what we want to be variable name)
that's easily solved
we have another issue tho
VarName is the variable which is the name of our variable
so instead of "myvarxx" we put something in the value of VarName and thats it
hold on wait
the user of the program can select whats inside the varname parenthesis and thats the var name
(what is printed)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"__method__",
object.__class__.__class__("method", (), {
"take_argument": print
})
)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"setobj",
object.__class__.__class__("class", (), {
"varobj": __method__.take_argument
})
)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"setvariablename",
setobj.varobj
)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"varname",
setvariablename("VARIABLENAME")
)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"__method__",
object.__class__.__class__("method", (), {
"take_argument": print
})
)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"setobj",
object.__class__.__class__("class", (), {
"varobj": __method__.take_argument
})
)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"setvariablevalue",
setobj.varobj
)
__builtins__.__import__('sys')._getframe(0).f_globals.__setitem__(
"varval",
setvariablevalue(50)
)
__builtins__.__import__('os').system("cls")
print(varval, varname)
Here we have a big issue
output:
None None
oh no....
goddamn it man we cant print that
printing a print results in None
instead of print we need to use return
when we do:
varval
varname
it wont print anything at all
them both are NoneType
!e py py = print('deez') print(py)
@sick hound :white_check_mark: Your eval job has completed with return code 0.
001 | deez
002 | None
oh shit...
@sick houndim gonna go play some seige
then later im gonna start trying to figure out how to solve the error
you can start before me if you want
cya
good luck!
Thank, bye!
cya gl
Here's a weird one:
I want to turn an arbitrary character into its associated Bezier curve (in B(t) form). Not the outline but just a single line or a list of curves that would be the bare-minimum to describe the letter.
Ultimately, I would like to be able to say "construct a letter using n number of points" and by converting n to dt and feeding it into B(t), the program would then return a list of x-y coordinates that would smoothly construct the character
Here's a package that "almost" does what I want: https://github.com/rougier/freetype-py
While it would be cool to procedurally generate the curves, if someone has already generated the curves for the latin alphabet, I would be fine with hardcoding the curves
What about a fourier transform instead?
