#esoteric-python

1 messages · Page 134 of 1

sick hound
#

ty

novel scarab
#

np

prisma coral
#

!e

print(list(map(str, [1,2,3])))
night quarryBOT
#

@prisma coral :white_check_mark: Your eval job has completed with return code 0.

['1', '2', '3']
prisma coral
#

And you can obfuscate the builtins with that getattr thing I showed you before

sick hound
#

hey nice

#

good for the program

#

thanks

vague cairn
#

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.

sick hound
#

lol

#

also uh

#

i accidentally made an error in my code

vague cairn
#
inc = lambda x: int(chr(x+49))
dec = lambda x: int(chr(x+47)) 

"hey, why doesn't your interface work for negative numbers?"

sick hound
#

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

prisma coral
#

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

sick hound
#

so how would i solve it?

#

i need to make another variable i think

prisma coral
#

make self be 0 ¯_(ツ)_/¯

sick hound
#

just for indexing into the list

#

then make that list spot 0

prisma coral
#

Yeah that works

sick hound
#

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

prisma coral
#

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
sick hound
#

so i assign it after

#

by it i mean the value of my long underscore variable

prisma coral
#

Why do you want to reassign it

sick hound
#

variable is equal to 5, so i get the 6th thingy which is 0

#

so self = 0

#

and code returns false

#

thats why

prisma coral
#

But how does that relate to the looping variable?

#

It sounds like you are just trying to create a new variable

sick hound
#

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

prisma coral
#

Well this doesn't make much sense:

[... for ... in range(...) := ...]
#

(lines 10 and 11 of the paste)

sick hound
#
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

prisma coral
#

I'm not sure what you were even trying to do there

#

Also I'm off to bed now

#

See y'all tomorrow

sick hound
#

cya

#

gn

vague cairn
#

cya.

sick hound
#

hi

vague cairn
#

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.

sick hound
#

@vague cairn about my code uh

vague cairn
#

?

sick hound
#

how can i get self = 0

#

maybe u could help me

vague cairn
#

I'm still fussing with my polymorphing lazy load proxy class

sick hound
#

could u please read through the past convo if you have the time and try help me out

vague cairn
#

it's really not the kind of obfuscation that I enjoy.

sick hound
#

its not about that

#

its about the idea

#

of trying to get self = 0

#

in my code

vague cairn
#

pass it an int? or something that provides an .__index__() that returns 0

sick hound
#

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

sick hound
vague cairn
#

!e

def x():
  self = 0
  print(eval(type(None).__bool__.__doc__))
  self = 1
  print(eval(type(None).__bool__.__doc__))
x()
night quarryBOT
#

@vague cairn :warning: Your eval job has completed with return code 0.

[No output]
sick hound
#

that works

#

but how do i make sure lambda syntax doesnt break

vague cairn
#

oh

sick hound
#

invalid syntax. Perhaps you forgot a comma? is the error for this code

vague cairn
#

can you do __globals__.__setitem__() or something?

sick hound
#
for ___ in range(__) if ((_______)) !=[(([]==[]))-(___)]]][___]: self == 0 eval(type(None).__bool__.__doc__))())```
#

it says i forgot a comma

#

where tho

#

after 0

vague cairn
#

no, self ==0 compares self to 0
self := 0 might work.

sick hound
#

il try

#

its saying the same thing

vague cairn
#

!e

x = lambda s:(self :=s, print(eval(type(None).__bool__.__doc__)))
for i in range(-2,3):
  print(x(i))
night quarryBOT
#

@vague cairn :white_check_mark: Your eval job has completed with return code 0.

001 | True
002 | True
003 | False
004 | True
005 | True
sick hound
#

i need the comma

#

now it says self is not defined

#

tf

vague cairn
#

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.

sick hound
#

it will be easier to just show you this

vague cairn
#

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.

sick hound
#

my whole code

#

Lies() prints true instead of false

vague cairn
#

I am not parsing that.

sick hound
#

because self != 0

vague cairn
#

right.

sick hound
#

self = 16 as the thing im indexing the list has a value of 2 which accesses 3rd value which is 16

vague cairn
#

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.

vague cairn
#

!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))
night quarryBOT
#

@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
golden finch
#

How can I get the docstring of a module, if even possible?

#

i.e

#

!e

"""
print(2)
"""
exec(__doc__)
night quarryBOT
#

@golden finch :white_check_mark: Your eval job has completed with return code 0.

2
golden finch
#

Wait, what?

sick hound
#

well you got it, __doc__ is how you access it

fleet bridge
#

!e

import sys
current_module = sys.modules[__name__]
print(current_module)
night quarryBOT
#

@fleet bridge :white_check_mark: Your eval job has completed with return code 0.

<module '__main__' (built-in)>
fleet bridge
#

will it work in all cases?

fleet bridge
#

imho modules should have __module__ attribute, containing module itself

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

__main__
golden finch
#
>>> 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?

sick hound
#

!e ```py
=().class.class("", (), {"init": lambda __:return })
print(
.module)

night quarryBOT
#

@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
sick hound
#

!e ```py
=().class.class("", (), {"init": lambda __:return })
print(
.module)

night quarryBOT
#

@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
sick hound
#

!e ```py
=().class.class("", (), {"init": lambda : print()})
print(__.module)

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

__main__
golden finch
#

isn't that just type?

#

interesting way of getting it

sick hound
golden finch
#

I am aware of that

#

One second

golden finch
# sick hound 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')
night quarryBOT
#

@golden finch :white_check_mark: Your eval job has completed with return code 0.

001 | a
002 | a
003 | a
004 | b
005 | b
golden finch
#

I think I know how to use type :)

sick hound
#

sry

golden finch
#

no problem

sick hound
#

I'm just blown out I learned this yesterday

golden finch
#

you can also use 1. __class__.__class__

sick hound
#

Hm how come?

golden finch
#

You learn a lot from this channel

sick hound
#

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

sick hound
golden finch
#

You definitely should, it's the beating heart of this channel

#

Also learn about metaclasses

#

and especially lambdas

#

lots and lots of lambdas

sick hound
golden finch
#

Oh you should

sick hound
sick hound
#

without using lambda at all

sick hound
#

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

sick hound
#
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?

fleet bridge
#

lambda ...: [...] = ...

#

you cannot assign to lambda

#

have you ever written in python?

sick hound
#

idk how lambdas work that well

#

i think i accidentally changed smth

#

when i wrote the code it was working

earnest wing
#

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

sick hound
#

yeah me and @sick hound

#

are doing it

sick hound
#

we are making progress in dms rn

earnest wing
#

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)

sick hound
#
__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?

fleet bridge
#
>>> issubclass(int, type)
False
#

???

#

why int is not subclass of type?

astral rover
#

int is an instance of type

fleet bridge
#

oh

astral rover
#

its a subclass of object

fleet bridge
sick hound
fleet bridge
#

create a script using only dundermethods with no common builtin keyword and methods

#

you use builtin name

#

__builtins__ is builtin name

sick hound
#

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

fleet bridge
#

!e
print(1 .class.base.subclasses()[45])

night quarryBOT
#

@fleet bridge :white_check_mark: Your eval job has completed with return code 0.

<class 'module'>
sick hound
#

!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()

night quarryBOT
#

@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
sick hound
#

!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()

night quarryBOT
#

@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
sick hound
#

!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

night quarryBOT
#

@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
sick hound
#

!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()

night quarryBOT
#

@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
sick hound
#

!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

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

[]
sick hound
#

!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")

night quarryBOT
#

@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
sick hound
#

!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)

night quarryBOT
#

@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
sick hound
#

!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"])

night quarryBOT
#

@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
sick hound
#

!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()

night quarryBOT
#

@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
sick hound
#

!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

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

[]
sick hound
#

!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

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

[]
sick hound
#

!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

night quarryBOT
#

@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
sick hound
#

!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

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

[]
sick hound
#

!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

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

<generator object <genexpr> at 0x7f0050f73d10>
sick hound
#

!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

night quarryBOT
#

@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
sick hound
#

!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")

night quarryBOT
#

@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
sick hound
#

!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()

night quarryBOT
#

@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
sick hound
#

!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()

night quarryBOT
#

@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
sick hound
#

!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

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

<generator object <genexpr> at 0x7fe5cca47d10>
sick hound
#

!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

night quarryBOT
#

@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
sick hound
#

!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

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

<generator object <genexpr> at 0x7f3febd6bd10>
earnest wing
#

str is not a dunder

sick hound
#

Ik I have to cheat a little atm

earnest wing
#

object isn't either

sick hound
#

I need to get the code to work first before trying to replace those stuff

earnest wing
#

are you allowing comprehensions?

sick hound
#

yes

#

for now

fleet bridge
#

!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)
night quarryBOT
#

@fleet bridge :white_check_mark: Your eval job has completed with return code 0.

<module 'builtins' (built-in)>
fleet bridge
#

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?

earnest wing
#

Int literals can be constructed by slicing bytes objects, too

fleet bridge
#

!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]
night quarryBOT
#

@fleet bridge :warning: Your eval job has completed with return code 0.

[No output]
fleet bridge
#

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__'))
night quarryBOT
#

@fleet bridge :white_check_mark: Your eval job has completed with return code 0.

001 | <built-in function eval>
002 | <module 'builtins' (built-in)>
fleet bridge
#

!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',
)
night quarryBOT
#

@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

sick hound
#

!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()```

night quarryBOT
#

@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
fleet bridge
#

!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!")')
night quarryBOT
#

@fleet bridge :white_check_mark: Your eval job has completed with return code 0.

Hello World!
sick hound
#

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

fleet bridge
#

!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!")')
night quarryBOT
#

@fleet bridge :white_check_mark: Your eval job has completed with return code 0.

Hello World!
fleet bridge
#

ez

sick hound
#

@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

fleet bridge
#

not[()]

sick hound
#

: )

#

~ instead of not btw

fleet bridge
#

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)
night quarryBOT
#

@fleet bridge :white_check_mark: Your eval job has completed with return code 0.

False
fleet bridge
#

only tuple, list and lambda literals

#

formatted, but this isnt better SoSoHurt

sick hound
#

@fleet bridge how… how do u know all this?

sick hound
#

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

sick hound
#

😉

#

good old replace making everything brain damaging oh and dont forget lambda

fleet bridge
#

you cannot greatly simplify this using only tuple, list and lambda literals

sick hound
#

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")

night quarryBOT
#

@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
sick hound
#

weird

#

wonder if anything could be done with this

fleet bridge
#

yea, this is it

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

False
sick hound
#

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

sick hound
#

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

sick hound
#

to smth else

sick hound
#

shits hard man

sick hound
#

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

sick hound
#

nvm yeah

#

uhh this is hard

#

but it will be worth it

sick hound
#

I've asked in 5 different servers

#

No one knows pain

#

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((([]==[])-([]==[])))))```

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

1
sick hound
#

@sick hound wrote this and i inspired him

#

im proud

#

!e smh just do this... ```py
print(1)

🤦lol
night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

1
sick hound
#

xD

#

oh my god

#

!e py (__) = lambda ((_)):=((_)) + ([]==[])+([]==[])-([]==[]) print((__)(4))

night quarryBOT
#

@sick hound :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     (__) = lambda ((_)):=((_)) + ([]==[])+([]==[])-([]==[])
003 |                   ^
004 | SyntaxError: invalid syntax
sick hound
#

ffs

sick hound
#

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

night quarryBOT
#

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:

https://paste.pythondiscord.com

#

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:

https://paste.pythondiscord.com

sick hound
#

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

sick hound
#

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__

sick hound
#
__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

sick hound
sick hound
#

idk how we can do that

#

we ned

#

need to research that

novel scarab
#

I know u can make an empty function and then assign code to it

sick hound
#

@novel scarab

#

our challenge is to not using any commonly used methods, keywords and opperators

sick hound
#

lets see

#

empty function pog

novel scarab
#

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

sick hound
#
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

cloud fossil
#

You mean without number nor string literals

sick hound
#

yes

sick hound
#

or is it not possible

novel scarab
#

idk

sick hound
#

you could use a lambda?

#

using type maybe? @sick hound

cloud fossil
#

A lambda

sick hound
#

like how we made a class using lambda in bot commands yesterday

#

lambda is a common keyword

#

we are trying to make one ourselves

cloud fossil
#

Oh

novel scarab
#

you are using for in your code

sick hound
#

you could use a class?

#

we will change that @novel scarab

#

dw

#

and we could keep it ig

sick hound
#

im suggesting it

cloud fossil
#

Wait so what are the restrictions?

sick hound
#

well it works for creating a class, I don't think we can create a function though

cloud fossil
#

If everything is an object in Python we should be able to create a function object somehow, right?

sick hound
#

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

cloud fossil
#

Replace with what

sick hound
#
().__class__.__class__("", (), {})
#or
str.__class__("", (), {})

Creates a class

#

shouldn't there be __func__?

novel scarab
#

types.FunctionType ?

sick hound
novel scarab
#

oh

sick hound
#

we avoid using the type() method too, hence ().__class__.__class__()

#

It does the same thing tho

unique rose
#

(lambda x:x).__class__

sick hound
cloud fossil
#

We are trying to make them

sick hound
#

That's what the whole thing is about 😂

sick hound
#

!e ```py
().class.class("Myclass", (), {
"init": lambda x: print(x)
})

Myclass.init("hi")

night quarryBOT
#

@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
sick hound
#

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")

night quarryBOT
#

@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
cloud fossil
#

Wait can we use classes?

#

Indirectly using type

#

You know

sick hound
#

!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"custom",
object.class.class("class", (), {
"init": lambda x: print(x)
})
)

custom.init("hi")

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

hi
cloud fossil
#

Are we allowed to use the return keyword

sick hound
cloud fossil
#

Alright

#

Can classes return

#

😂

#

Can we use inheritance?

sick hound
#

Classes can't return iirc

sick hound
#

inhertiancr

cloud fossil
#

How do you inherit using the golfed way?

sick hound
#

🤷

sick hound
cloud fossil
#

I imagine we can return something if we inherit some built-in

sick hound
#

and replace

cloud fossil
#

Maybe eval

unique rose
sick hound
#

we can return eval

#

!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
None: print("hi")
})
)
method()

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

hi
sick hound
#

guys

cloud fossil
#

My God

sick hound
#

oh

#

!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
None: print("hi")
})
)
method

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

hi
unique rose
#

why dont you just use "print"

sick hound
#

hmm

cloud fossil
#

Lol

sick hound
#

print common keyword

sick hound
unique rose
#

print isnt a keyword, is a function

sick hound
#

still bad

unique rose
#

"__init__": print

sick hound
#

!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"x": print(x)
})
)
method."hello"

night quarryBOT
#

@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
sick hound
#

!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"x": print(x)
})
)
method.lol

night quarryBOT
#

@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
sick hound
#

!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"x": print("hi")
})
)
method

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

hi
sick hound
#

!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"x": print("hi")
})
)
method.x

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

hi
sick hound
#

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

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

001 | x
002 | y
sick hound
#

!e py __builtins__.__import__('sys')._getframe(0).f_globals.__setitem__( "method", object.__class__.__class__("method", (), { "x": print("hi") }) ) x()

night quarryBOT
#

@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
sick hound
#

oh mb

#

why don't you do __import__('os').write(1,"hi") lol

cloud fossil
#

We're trying to make lambdas

sick hound
#

!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

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

001 | x
002 | y
sick hound
#

!e __builtins__.__import__('sys')._getframe(0).f_globals.__setitem__( "method", object.__class__.__class__("method", (), { "x": stdout.write("hi") }) ) method.x

night quarryBOT
#

@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
sick hound
#

!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

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

xy
sick hound
#

!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

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

001 | x
002 | y
sick hound
#

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

night quarryBOT
#

@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'
sick hound
#

!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()

night quarryBOT
#

@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'
unique rose
#

__import__('sys')._getframe(0).f_globals.update({"say": type("sayer", tuple(), {"__init__": print })})

#

say("hi")

sick hound
#

Try that

unique rose
#

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")

sick hound
#

!e ```py
builtins.import('sys')._getframe(0).f_globals.setitem(
"method",
object.class.class("method", (), {
"x": print,
"y": print
})
)
method.x
method.y

night quarryBOT
#

@sick hound :warning: Your eval job has completed with return code 0.

[No output]
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

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

hi
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")

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

001 | hi
002 | lol
sick hound
#

Yoooooo

#

Wait

#

Hold on

#

we are making progress

#

Is there an alternative to print?

#

yeah

#

stdout.write

unique rose
#

lambda is very not that often required, python programmers dramatically overuse it

sick hound
#

i think

sick hound
#

!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")

night quarryBOT
#

@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)
unique rose
#

eg., map(str.split, ...)

sick hound
#

Nope

unique rose
#

i dont mean it isnt required in the sense that "just use a for loop"

sick hound
#

!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")

night quarryBOT
#

@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
unique rose
#

i mean its literally not required for funcitonal programming in python

shut trail
#

!e

testing = type("testing", (), {None: 1})

print(testing)
testing + 1
sick hound
novel scarab
#

try getattr

sick hound
#

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))

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

001 | hi
002 | lol
003 | <class 'builtin_function_or_method'>
sick hound
#

lets see what we get from there

#

hmm so

#
sys.stdout.write()```
sick hound
#

that's exactly what we tried

#

try os.write

#

!e ```py
print(type(print))

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

<class 'builtin_function_or_method'>
sick hound
#

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')```
unique rose
#

globals()['say'] = type("sayer", tuple(), {"__init__": print})

sick hound
#

try

#

credit to @rugged sparrow

sick hound
#

maybe theres an alternative to globals?

unique rose
#

what more are you after?

sick hound
#

maybe a dunder method

#

No we can't use print

sick hound
#

ah theres print

#

oh mb yeah we do

unique rose
#

what's the goal?

sick hound
#

I think

sick hound
#

yeah

unique rose
sick hound
#
(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``
night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

<class 'builtin_function_or_method'>
unique rose
#

you cant do anything with builtins

#

python has lots of callable()s, functions, builtins, methods, etc.

sick hound
#

fairly obvious...

#

Yes but what can I do with 'builtin_function_or_method'

unique rose
#

you want to create your own print function in a single-line of python code, without using print or lambda?

sick hound
#

nothing

unique rose
#

is that the goal?

sick hound
#

ah alright

sick hound
unique rose
#

what would "your own version of lambda" do?

#

you're trying to make def a function?

#

eg., define(name, args, code)

sick hound
#

our own

#

lambda

#

thing with the function of a lambda

#

variable with lambda functionality

unique rose
#

lambda constructs a code frame, you'd need to use someething eval-like

sick hound
#

i gtg

#

oh

#

goodbye

unique rose
#

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

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")

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

hello
sick hound
#

!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")

night quarryBOT
#

@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
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

night quarryBOT
#

@sick hound :warning: Your eval job has completed with return code 0.

[No output]
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": builtins.import('sys')._getframe(0).f_globals.setitem(
"arg1",
method.take_argument
),
builtins.import('sys').stdout.flush()
})
)

custom.init("hello")

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

001 | 
002 | hello
unique rose
#

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"

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": builtins.import('sys')._getframe(0).f_globals.setitem(
"arg1",
method.take_argument
),
builtins.import('sys').stdout.flush()
})
)

custom.init("hello")

night quarryBOT
#

@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
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": builtins.import('sys')._getframe(0).f_globals.setitem(
"arg1",
method.take_argument
),
None: builtins.import('sys').stdout.flush()
})
)

custom.init("hello")

night quarryBOT
#

@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
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": builtins.import('sys')._getframe(0).f_globals.setitem(
"arg1",
method.take_argument
),
"init": builtins.import('sys').stdout.flush()
})
)

custom.init("hello")

night quarryBOT
#

@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
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": builtins.import('sys')._getframe(0).f_globals.setitem(
"arg1",
method.take_argument
),
"x": builtins.import('sys').stdout.flush()
})
)

custom.init("hello")
custom.x

night quarryBOT
#

@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
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": builtins.import('sys')._getframe(0).f_globals.setitem(
"arg1",
method.take_argument
)
#"x": builtins.import('sys').stdout.flush()
})
)

custom.init("hello")

night quarryBOT
#

@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
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, builtins.import('sys')._getframe(0).f_globals.setitem(
"arg1",
method.take_argument
)]
#"x": builtins.import('sys').stdout.flush()
})
)

custom.init("hello")

night quarryBOT
#

@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
sick hound
#

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")

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

hello
sick hound
#

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")

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

hello
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, "hi")
})
)

custom.init("hello")

night quarryBOT
#

@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
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")

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

hello
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; print("hi")
})
)

custom.init("hello")

night quarryBOT
#

@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
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 print("hi")
})
)

custom.init("hello")

night quarryBOT
#

@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?
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, print("hi")
})
)

custom.init("hello")

night quarryBOT
#

@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
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, print("hi"): None
})
)

custom.init("hello")

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

001 | hi
002 | hello
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, builtins.import('os').system("clear"): None
})
)

custom.init("hello")

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

hello
sick hound
#

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

unique rose
#

you can defined a global dictionary to whole arguments for you function

#

*define

sick hound
#

i'm fairly certain theres a way of doing this

sick hound
unique rose
#

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

sick hound
#

What does that mean?

unique rose
#

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...

sick hound
#

Oh yeah I see what you mean

#

the "PrintVariable" is basically what we've done so far

unique rose
#

yeah

sick hound
#

the "SetVariable" is the hard part

unique rose
#

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

sick hound
#

xD

#

Then, it is actually possible 😂

#

Has someone ever done this in python before?

#

The project me and @sick hound have??

unique rose
#

not that i'm aware of, but it's common in some languages, eg., scala

sick hound
#

idk man

unique rose
#

some languages essentially are designed to make this the way you're supposed to program

sick hound
#

Yeah, it would actually be a great experience doing this, I will continue this shit lmao

#

im back

#

same bro

unique rose
#

yeah, if you take this approach, ie., re-representing primitivate operations in your own internal language system

then i suspect it will work

sick hound
#

its really interesting

sick hound
#

lmao

sick hound
#

print takes the argument

#

but doesnt print

#

that seems giga sus idk man

unique rose
#

a simple "final embedding" would be something like,

program = [(print, "hello"), (list, (1, 2, 3)]

[ f(x) for f, x in program ]

sick hound
#

we clear the terminal immediately after and save information like a function

#

yield keyword

#

can we try something like that

unique rose
#

if you run your program using a comprehension, ie., [f(x) ...for...] you may be able to pass your gloabl state as a variable

sick hound
#

Guys

#

I just created a function

#

without lambda

#

and def

#

successfully

unique rose
#

...

sick hound
#

lol

#

wanna see it?

unique rose
#

go on thne

sick hound
#
__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

unique rose
#

print just puts it on the screen though, not in memory

sick hound
#

yeah we can store it, but I'm not there yet, I first have to figure out how to use setobj.delout

unique rose
#

you need function composition

#

i dont think there's anyhting in-built in ptyhon to do it

sick hound
#

to be able to use setobj.delout?

unique rose
#

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

sick hound
#

Oh shit

unique rose
#

partial objects in the functools lib might work

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(
"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")```

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

hi
sick hound
#

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

night quarryBOT
#

@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?
sick hound
#

yeah

#

it's annoying

sick hound
sick hound
#

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

night quarryBOT
#

@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?
sick hound
#

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"

sick hound
#

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

#

oh uh btw this can make our own return keyword

sick hound
#

variable becomes an empty list beforehand, yield it and bam it returns

sick hound
#

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!!

novel scarab
sick hound
#

they're 37

#

13

#

you're incredibly good at this for your age lol

sick hound
novel scarab
sick hound
#

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

sick hound
#

thats the ONE thing we know

sick hound
sick hound
#

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

sick hound
#

sussy i know lmfao

#

LUP best language

#

But the girl needs to have high IQ tho, otherwise the child will be braindead

novel scarab
#

joelang is best lang wym

sick hound
#

boy or girl

#

idk

sick hound
sick hound
#

joemamalang

novel scarab
#

and banner

sick hound
#

xD

#

@sick hound ignore it

#

just another illegitimate language

novel scarab
#

we have a website

#

do you?

sick hound
#

with an uncoordinated and unexperienced dev team

#

we will

novel scarab
#

wym unexperienced

novel scarab
sick hound
#

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

sick hound
#

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

novel scarab
#

joelang owns all

sick hound
#

yeah

#

py and _ only?

#

py. infront of everything

sick hound
sick hound
novel scarab
#

yo

sick hound
#

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

novel scarab
#

joelang ftw

#

lup not ftw

thin olive
#

😱

sick hound
#

@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

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

myvarxx
sick hound
#

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```

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

deez
sick hound
#
__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)

night quarryBOT
#

@sick hound :white_check_mark: Your eval job has completed with return code 0.

001 | deez
002 | None
sick hound
#

@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

halcyon bay
#

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

GitHub

Python binding for the freetype library. Contribute to rougier/freetype-py development by creating an account on GitHub.

#

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?

unique rose
#

could you just process the bitmaps of that library?