#esoteric-python

1 messages ยท Page 103 of 1

plucky wedge
#

!e

print((3).__add__(__import__("operator").floordiv(__import__("random").randint(1,10000000), __import__("random").randint(1,10000000))))
night quarryBOT
#

@plucky wedge :white_check_mark: Your eval job has completed with return code 0.

3
plucky wedge
#

lol

naive roost
#

I got at most a 6 for now, I'm going to do a little statistical analysis

plucky wedge
#

!e

print(chr((3).__add__(__import__("operator").floordiv(__import__("random").randint(1,10000000), __import__("random").randint(1,1000000)))))
night quarryBOT
#

@plucky wedge :white_check_mark: Your eval job has completed with return code 0.


plucky wedge
#

fun

naive roost
#

ok, out of 10_000_000 such numbers, I got an average of around 10.56, a standard deviation of about 1215, with a median of 3, a 75th-percentile of 4, 90th percentile of 7, 99th percentile of 52, and maximum of 1904107. wow, that's quite clumped around 3

plucky wedge
#

are u talking to me?

naive roost
#

I just wanted to do a quick analysis of the results of your code ๐Ÿ˜…

plucky wedge
#

oh!

#

Cool!

#

I think it gets 0 a lot so adding 3 makes it 3

#

and its floored

naive roost
#

interesting phenomenon: the standard deviation increases as you remove the smallest elements. that's quite an interesting distribution you got us ๐Ÿ˜„

plucky wedge
#

im not sure i know what that means

#

I still have yet to take anything on statistics so

rugged sparrow
#

@bitter iris it all stems from the fact that LOAD_CONST doesnt do bounds check

plucky wedge
#

;/

rugged sparrow
#

so you can construct a fake bytearray object to get r/w to pythons entire address space

naive roost
#

wow, that's... interesting to say the least (talking to chilaxan)

rugged sparrow
#

!e ```py
def sizeof(obj):
return type(obj).sizeof(obj)

TUPLE_HEADER = sizeof(())
BYTES_HEADER = sizeof(b'') - 1
PTR_SIZE = sizeof((0,)) - TUPLE_HEADER
MAX_INT = (1 << PTR_SIZE * 8 - 1) - 1

def load_addr(addr):
magic = lambda:None
b_addr = addr.to_bytes(PTR_SIZE, 'little')
offset = id(b_addr) + BYTES_HEADER
offset -= id(magic.code.co_consts) + TUPLE_HEADER
offset //= PTR_SIZE
if offset < 0: # overflow offset to convert to unsigned
offset += 0xffffffff + 1
co_code = bytes((0x64, offset & 0xff))
offset >>= 8
while offset > 0:
co_code = bytes((0x90, offset & 0xff)) + co_code
offset >>= 8
co_code += bytes((0x53, 0))
magic.code = magic.code.replace(
co_code=co_code
)
return magic()

memory_backing = b''.join(n.to_bytes(PTR_SIZE, 'little') for n in (
1,
id(bytearray),
MAX_INT,
0, 0, 0, 0
))

mem = load_addr(id(memory_backing) + BYTES_HEADER)

mem is now a bytearray pointing to the entire address space```

night quarryBOT
#

@rugged sparrow :warning: Your eval job has completed with return code 0.

[No output]
rugged sparrow
#

@naive roost that is the basic construct

naive roost
#

oh, right. I don't understand much of that, though

sick hound
#

dafq

naive roost
#

that's what you get when you delve in CPython's internals, but in Python

sick hound
#

this is too high low level for me

sudden willow
#

why print and not (__import__("sys").stdout.write())

#

made my hello world statement longer btw

#

!e

(
  (_:=lambda _:(_ := _.__add__(__name__.__len__().__bool__().__int__())),
  
  (__import__("sys").stdout.write(
    chr(__:=[_(x) for x in range(ord(chr(72)).__int__())][-(__debug__.__int__())]).__add__(
      chr(__:=[_(x) for x in range(ord(chr(101)).__int__())][-(__debug__.__int__())]).__add__(
        chr(__:=[_(x) for x in range(ord(chr(108)).__int__())][-(__debug__.__int__())]).__add__(
          chr(__:=[_(x) for x in range(ord(chr(108)).__int__())][-(__debug__.__int__())]).__add__(
            chr(__:=[_(x) for x in range(ord(chr(111)).__int__())][-(__debug__.__int__())]).__add__(
              chr(__:=[_(x) for x in range(ord(chr(44)).__int__())][-(__debug__.__int__())]).__add__(
                chr(__:=[_(x) for x in range(ord(chr(32)).__int__())][-(__debug__.__int__())]).__add__(
                  chr(__:=[_(x) for x in range(ord(chr(87)).__int__())][-(__debug__.__int__())]).__add__(
                    chr(__:=[_(x) for x in range(ord(chr(111)).__int__())][-(__debug__.__int__())]).__add__(
                      chr(__:=[_(x) for x in range(ord(chr(114)).__int__())][-(__debug__.__int__())]).__add__(
                        chr(__:=[_(x) for x in range(ord(chr(108)).__int__())][-(__debug__.__int__())]).__add__(
                          chr(__:=[_(x) for x in range(ord(chr(100)).__int__())][-(__debug__.__int__())]).__add__(
                            chr(__:=[_(x) for x in range(ord(chr(33)).__int__())][-(__debug__.__int__())])
))))))))))))))))
night quarryBOT
#

@sudden willow :white_check_mark: Your eval job has completed with return code 0.

Hello, World!
lavish shore
#

longer, but short enough to paste in here for immediate eval
tbh that's a good goal

sudden willow
#

can aswell be condensed down into a single line as its a tuple

#

!e

((_:=lambda _:(_ := _.__add__(__name__.__len__().__bool__().__int__())),(__import__("sys").stdout.write(chr(__:=[_(x) for x in range(ord(chr(72)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[_(x) for x in range(ord(chr(101)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[_(x) for x in range(ord(chr(108)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[_(x) for x in range(ord(chr(108)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[_(x) for x in range(ord(chr(111)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[_(x) for x in range(ord(chr(44)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[_(x) for x in range(ord(chr(32)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[_(x) for x in range(ord(chr(87)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[_(x) for x in range(ord(chr(111)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[_(x) for x in range(ord(chr(114)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[_(x) for x in range(ord(chr(108)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[_(x) for x in range(ord(chr(100)).__int__())][-(__debug__.__int__())]).__add__(chr(__:=[_(x) for x in range(ord(chr(33)).__int__())][-(__debug__.__int__())])))))))))))))))))
night quarryBOT
#

@sudden willow :white_check_mark: Your eval job has completed with return code 0.

Hello, World!
sudden willow
#

probably my best esoteric work

stark fable
sudden willow
#

fair enough

#

!e

(
    _ := lambda message: print(message),
    _("i wonder if this works"))
night quarryBOT
#

@sudden willow :white_check_mark: Your eval job has completed with return code 0.

i wonder if this works
lavish shore
#

whatever _ is doing is very mysterious to me

#

oh wait I think I see it

naive roost
#

basially, what cityshow is doing is _ = print

lavish shore
#

got it

sick hound
#

!e (_:=print, _("hello world"))

#

@sudden willow vv

night quarryBOT
#

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

hello world
lavish shore
#

wait can I just start using _ for varnames everywhere

sick hound
#

yes

#

you can

lavish shore
#

๐Ÿ‘€

sick hound
#

ngl i really want to try to create a really basic python obfuscator

cloud hound
#

anyone know how to collapse cells in jupytr notebook?

#

i remember doing it once and I forgot..

lavish shore
#

alright y'all, we need an esoteric python implementation for this

#

more srsly tho idk :c

cloud hound
#

lol its all good back to google

sick hound
#

lol

cloud hound
#

ugh i can collapse the output cell but not input

sick hound
#

hey quick question

#

since there's an sys.stdout.write()

#

is there an input version of it?

#

nvm

#

there's a sys.stdin.readline()

sick hound
#

fuckk i don't want to write an expression parser

sick hound
#

!e

[a:=__name__.__len__().__bool__().__int__(), __import__("sys").stdout.write(a.__str__().__add__(chr(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__pow__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__())).__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__())))))]```
night quarryBOT
#

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

1
sick hound
#

(pretend "sys" is chr(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__()...)

#

equivalent code is

#
a = 1
print(a)```
#

actually here

#

!e

[a:=__name__.__len__().__bool__().__int__(), b:=__name__.__len__().__bool__().__int__(), c:=a.__add__(b), __import__('sys').stdout.write(c.__str__().__add__(chr(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__pow__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__())).__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__())))))]```
night quarryBOT
#

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

2
sick hound
#

(sys is here cause otherwise discord would throw a fit)

#

equivalent code is

#
a = 1
b = 1
c = a + b
print(c)```
lavish shore
#

I find it interesting how you made the print statement so verbose

#

I wonder if the a+b part can be made into a bunch of 1+1s

sick hound
#

do it the brainfuck way I guess

lavish shore
sick hound
#

powerful

snow beacon
sick hound
#

do everything with a series of increments ofc

#

it is literally that

#

lmfao

#

but with some slight optimizations

#

remove the optimizations and further obfuscate

#

only way to progress ofc

#

no like i don't want it too big

#

cause like

#

it wont fit on discord then

lavish shore
#

yeah, won't be as easy to demo it

sick hound
#

oh fair enough

lavish shore
lavish shore
sick hound
#

?

#

@lavish shore wdym

#

!e
[a:=__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__()), b:=__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__()), c:=a.__add__(b), __import__('sys').stdout.write(c.__str__().__add__(chr(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__pow__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__())).__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__())))))]

night quarryBOT
#

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

7
sick hound
#

3 + 4

#

doesn't fall under my optimisation algo cause it's short enough

lavish shore
#

it's just that the add is c:=a.add(b)

sick hound
#

?

lavish shore
#

nvm

sick hound
#

!e

[a:=__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__pow__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__())).__add__(__doc__.__bool__().__int__()), b:=__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__pow__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__())).__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__pow__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__()))).__add__(__name__.__len__().__bool__().__int__()), c:=a.__add__(b), __import__('sys').stdout.write(c.__str__().__add__(chr(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__pow__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__())).__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__())))))]```
night quarryBOT
#

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

73
sick hound
#

imagine that

#

but with __add__

#

32 + 41

lavish shore
#

ooh

sick hound
#

if given the vars, i could also replace all of the vars with _

#

and bool

#

now i need to write conditionals

#

and loops

#

and boom turing complete

#

sighs

lavish shore
#

ya is tedious

sick hound
#

it's beautiful isn't it...

#

but actually

#

technically

lavish shore
#

that it is

sick hound
#

i have a thing to convert string -> dunder level encoding

#

and theoretically i could wrap that in an exec(eval())

#

but i can only work with ints

#

:c

grave rover
#
import unittest

from mixin.decorators import inject
from mixin.entities import At
from mixin.enums import InjectionPoint


def head_target():
    print("head_target")
    return 10


def tail_target():
    print("tail_target")
    return 10


def return_target(check: bool):
    print("return_target")
    if check:
        return 100
    return 30


class InjectTestCase(unittest.TestCase):
    def info(self, tgt):
        # disassemble(tgt.__code__)
        pass

    @staticmethod
    @inject(head_target, At(InjectionPoint.HEAD), True)
    def inject_head_cancel(cbr):
        print("hi from head cancel")
        cbr.set_return(2)

    @staticmethod
    @inject(head_target, At(InjectionPoint.HEAD))
    def inject_head(cb):
        print("hi from head")

    def test_head(self):
        self.info(head_target)
        result = head_target()
        self.assertEqual(2, result)

    @staticmethod
    @inject(tail_target, At(InjectionPoint.TAIL))
    def inject_tail(cb):
        print("hi from tail")

    @staticmethod
    @inject(tail_target, At(InjectionPoint.TAIL), True)
    def inject_tail_cancel(cbr):
        print("hi from tail cancel")
        cbr.set_return(cbr.returned_value + 2)

    def test_tail(self):
        self.info(tail_target)
        result = tail_target()
        self.assertEqual(12, result)

    @staticmethod
    @inject(return_target, At(InjectionPoint.RETURN), True)
    def inject_return_cancel(cbr):
        print("hi from return cancel")
        cbr.set_return(cbr.returned_value * 2)

    def test_return(self):
        self.info(return_target)

        self.assertEqual(200, return_target(True))
        self.assertEqual(60, return_target(False))


if __name__ == '__main__':
    unittest.main()
#

this works somehow

#

cbr stands for CallbackReturnable in case anyone's wondering

sick hound
#

the fuck

lavish shore
#

never used unittest so idk what "the usual" is for that

#

oh wait

#

imagine for bool methods just injecting a negator at the end

sick hound
#

!e

[a:=[_:=__import__('sys'), _.stdout.write(chr(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__pow__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__())).__add__(__name__.__len__().__bool__().__int__()).__pow__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__())).__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__pow__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__()))).__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__())))), _.stdin.readline()][__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__())], __import__('sys').stdout.write(a.__str__().__add__(chr(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__pow__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__()).__add__(__name__.__len__().__bool__().__int__())).__add__(__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__())))))]```
night quarryBOT
#

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

e
sick hound
#

good enough

tribal moon
#

ehhh it's better when everything are dunders

#

I can cook up a fully dunder print function for you

#

give me a bit

#

!e py __builtins__.__dict__[__builtins__.__dir__()[().__class__.__name__.__len__().__rmul__(__debug__.__add__(__debug__)).__rmul__({}.__class__.__name__.__len__())]]("Hello, World")

night quarryBOT
#

@tribal moon :white_check_mark: Your eval job has completed with return code 0.

Hello, World
tribal moon
#

here you go

#
__builtins__.__dict__[__builtins__.__dir__()[().__class__.__name__.__len__().__rmul__(__debug__.__add__(__debug__)).__rmul__({}.__class__.__name__.__len__())]](anything in here to call it)```
lavish shore
#

wow, ye did the thing

#

didn't know that was possible

sick hound
#

any way to overly complicate "return" ?

sudden willow
#

i like it

#

!e

(
    _ := lambda _: (__ := ({"testprint": "(__import__(\"sys\").stdout.write(f"{_}"))"}))
    _ := lambda _: (___ := lambda _: __["testprint"])
)
night quarryBOT
#

@sudden willow :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 2
002 |     _ := lambda _: (__ := ({"testprint": "(__import__(\"sys\").stdout.write(f"{_}"))"}))
003 |                                                                               ^
004 | SyntaxError: invalid syntax
sudden willow
#

juj

#

huh

sick hound
#

how

#

do you

#

print

#

something out???

#

the fuck

sudden willow
#

im not sure

#

brb

#

!e

((_ := {"cout": "__import__(\"sys\").stdout.write(f\"test\")"}), _ := lambda _: exec(_["cout"]))
night quarryBOT
#

@sudden willow :warning: Your eval job has completed with return code 0.

[No output]
sudden willow
#

huh

sick hound
#

cause you didn't call anything

#

!e ((_ := {"cout": "import("sys").stdout.write(f"test")"}), __ := lambda: exec(_["cout"]), __())

night quarryBOT
#

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

test
sick hound
#

give me terrible advice

lavish shore
#

scroll up for inspiration

earnest wing
#

class C: ... is just sugar for type("C", ...), and we don't want sugar

lavish shore
earnest wing
#

def foo(bar): source is just sugar for foo = types.FunctionType(types.CodeType(..., compile("source", ...)), ...), and we don't want sugar

lavish shore
#

wat.

sick hound
#

lmfaoo

sick hound
lavish shore
terse mortar
#

Binary is just sugar for computers, and we don't want binary

sick hound
#

lmfao

#

actually technically that's false

#

more like binary is just syntaxic sugar for transistors, and we don't want sugar

lavish shore
#

well you can use terrible electric components so that 0 and 1 aren't even clear

#

digital is sugar for analog?

sick hound
#

no clue

#

lol

terse mortar
#

And analog is sugar for information

lavish shore
#

not sure if there's an "analog computer" yet

sick hound
#

this thing?

#

also logic gates

#

chain enough of them together

#

and boom

lavish shore
#

oh no

terse mortar
#

And they said this channel couldn't get more cursed.

sick hound
#

lmfao

#

between dunder level encoding and other random shit?

low apex
#

Next challenge:
. You are given an infinite amount of NAND gates
. Make GTA V

earnest wing
#

NAND aren't turing-complete, strictly speaking
but it IS a universal gate

#

anyways, python frickery

lavish shore
low apex
#

Hmm...

#

I do wonder however, what it would be like if any sort of abstraction was forbidden past and, not and or gates

#

Probably a huge mess

#

probably

lavish shore
#

pretty much, yeah

lavish shore
#

!e

# Task: find the predecessor of a positive integer
# E.g. pred(1) = 0, pred(8) = 7
class Verify:
    def __init__(self, n, i):
        self.n = n
        self.i = i

    def __add__(self, x):
        return 1 if self.i + x == self.n else 0

def pred(n):
    verifiers = []
    for i in range(n):
        verifiers.append(Verify(n, i))
    
    pred_int = 0
    for i in range(n):
        if verifiers[i] + 1:
            pred_int = i

    return pred_int

print(pred(1))
print(pred(100))
night quarryBOT
#

@lavish shore :white_check_mark: Your eval job has completed with return code 0.

001 | 0
002 | 99
lavish shore
#

some totally efficient code I wrote a month or two ago

formal sandal
#

@quick wing Please don't dump random images, especially in on-topic channels

elfin onyx
#

!e

type('While',(),{"__iter__": lambda self: self, "__next__": lambda self: "Infinite", "__call__": lambda self: _ for _ in self()})()()
night quarryBOT
#

@elfin onyx :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     type('While',(),{"__iter__": lambda self: self, "__next__": lambda self: "Infinite", "__call__": lambda self: _ for _ in self()})()()
003 |                                                                                                                     ^
004 | SyntaxError: invalid syntax
elfin onyx
#

can someone help me implement this

thin trout
#

I think you have to put parenthesis around the lambda expressions

elfin onyx
#

ooh

elfin onyx
#

!e

(type('While',(),{"__iter__": (lambda self: self), "__next__": lambda self: ("Infinite"), "__call__":lambda self: [... for _ in self()]}))()()

Hmmm why does this give me recursion error rather than the bot saying it ran out of memory?

night quarryBOT
#

@elfin onyx :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 |   File "<string>", line 1, in <lambda>
004 |   File "<string>", line 1, in <lambda>
005 |   File "<string>", line 1, in <lambda>
006 |   [Previous line repeated 496 more times]
007 | RecursionError: maximum recursion depth exceeded
elfin onyx
#

got it

#

!e

(type('While',(),{"__iter__": (lambda self: self), "__next__": lambda self: ("Infinite"), "__call__":lambda self:([_ for _ in self.__class__()])}))()()
night quarryBOT
#

@elfin onyx :warning: Your eval job timed out or ran out of memory.

[No output]
elfin onyx
#

!e

print("\n".join((type('While',(),{"__iter__": (lambda self: self), "__next__": lambda self: ("Infinite"), "__call__":lambda self:(("Hello, World!" for _ in self.__class__()))}))()()))
night quarryBOT
#

@elfin onyx :warning: Your eval job timed out or ran out of memory.

[No output]
elfin onyx
#

why did this give no output??

twilit grotto
#

timed out or ran out of memory

elfin onyx
#

ye that kinda makes sense i think while joining it ran out of memory

sick hound
sick hound
#

infinite loop

#

โžฟ

proper vault
#

why not do

#
("Infinite" for _ in iter(int, 1))
naive roost
#

because esoteric Python

sudden willow
#

!e

("e" for _ in iter(int, 1))
night quarryBOT
#

@sudden willow :warning: Your eval job has completed with return code 0.

[No output]
sudden willow
#

guess not

naive roost
#

no, that's a generator expression

#

!e ```py
list(("e" for _ in iter(int, 1)))

night quarryBOT
#

@naive roost :warning: Your eval job timed out or ran out of memory.

[No output]
naive roost
#

once you start evaluating an infinite iterator, you run out of memory

sudden willow
#

tuples are so useful

#

oh wait i didn't put any variables in the list

#

!e

(
    _ := ["hi", ":P"],
    _ := [(_.append(__), _.pop(0), print("t")) for __ in _]
)
night quarryBOT
#

@sudden willow :white_check_mark: Your eval job has completed with return code 0.

001 | t
002 | t
sudden willow
#

huh

#

no loop sad

sick hound
#

i don't think you can have a inf while loop w/o running out of memory in python using list compr :c

#

!e [print(i) for i in iter(int, 1)]

night quarryBOT
#

@sick hound :x: Your eval job timed out or ran out of memory.

001 | 0
002 | 0
003 | 0
004 | 0
005 | 0
006 | 0
007 | 0
008 | 0
009 | 0
010 | 0
011 | 0
... (truncated - too many lines)

Full output: too long to upload

sick hound
#

wait

#

what

naive roost
#

you can't have an infinite list without running out of memory

sick hound
#

i stand corrected

#

it'll take a lot longer to run out of memory tho

naive roost
#

just by the mere fact that a list stores pointers to the elements, which are on the heap (meaning they have to be in memory, and pointers to them are definitely in memory too)

sick hound
#

nvm

grave rover
#
def pad_nop(instructions: List[Instruction]) -> List[Instruction]:
    return [x for i in instructions for x in [_instruction("NOP", 0), i]]
``` is there a better way to do this?
#

it basically adds a NOP before each instruction

lavish shore
#

that's pretty cool, tho I think that'd make a list of lists

#

also @grave rover what do you mean by a "better way"
do u want a shorter way, or a more obfuscated way, for example?

rugged sparrow
#

@grave rover you can use zip

grave rover
#

zip it with an infinite generator you mean?

#

but wouldn't that make a list of pairs?

rugged sparrow
#
def pad_nop(instructions):
     return sum([*zip(instructions, iter(lambda:_instruction("NOP", 0),0))],())
     ```
#

That should work I think

rugged sparrow
#
class Test(AccessControl):
    internal_method: PRIVATE

    def internal_method(self):
        return 'value'

    def public_method(self):
        return self.internal_method()
>>> t = Test()
>>> t.internal_method()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/chilaxan/Desktop/Coding/python/access_control/access_control.py", line 98, in get
    check_access_prot(protections, cls, self, frame)
  File "/Users/chilaxan/Desktop/Coding/python/access_control/access_control.py", line 91, in check_access_prot
    raise PrivateAccessError(read)
__main__.PrivateAccessError: attempted to read PRIVATE value
>>> t.public_method()
'value'
>>> ``` i added class variable access protection to python
lavish shore
#

new PEP when?

rugged sparrow
#

lmao

#

i added all the ones from java that made sense DEFAULT = 1 << 0 PROTECTED = 1 << 1 PUBLIC = 1 << 2 PRIVATE = 1 << 3 FINAL = 1 << 4 STATIC = 1 << 5

#

you can combine any of the first 4 with the last 2 but static is still a bit weird

#

if anyone wants to check out the code just ping me

lavish shore
#

it seems somehow you added a type annotation but that annotation actually does something during runtime? confused

rugged sparrow
#

!e ```py
class Foo:
v: int

print(Foo.annotations)```

night quarryBOT
#

@rugged sparrow :white_check_mark: Your eval job has completed with return code 0.

{'v': <class 'int'>}
rugged sparrow
#

you can get the annotations at runtime like that

lavish shore
#

ahh I'm still learning bout some builtins that I never previously had to use

#

like id, getattr

#

ig dunders come next

#

notices compile()
๐Ÿค”

sick hound
#

wack

#

i heard about like monitoring access

sick hound
night quarryBOT
#

@sick hound :warning: Your eval job timed out or ran out of memory.

[No output]
marsh void
#

@rugged sparrow hey, looks great! mind sharing some sources? also, I've come to tell that using cls.__annotations__ or function.__annotations__ is not as good as typing.get_type_hints(cls) or typing.get_type_hints(function) respectively

#

and even more so, because the latter were the things intended for use

rugged sparrow
#

typing.get_type_hints just gets __annotations__ and does some extra parsing to handle recursive type hints

#

I tend to use __annotations__ because it has the raw values from the class body

tribal moon
#
>>> my_tuple.append(3)
(3,)
>>> my_tuple.append(16)
(3, 16)```
#
class tuple(tuple):

    def __init__(self):
        self.self = self

    def append(self, item, /):
        self.self = (*self.self, item)
        return self.self
cloud fossil
#

what happens when you do such thing as self.self = self

proper vault
#

you get a reference cycle

#

it's mostly fine

grave rover
#

ignore the NOPs, those are purely to indicate injected instructions

ember grotto
#

hi i have a problem with my tcp chat room it works fine on a local network but i cant get it to run outside my network
can you help me

astral rover
#

this is not the place to be asking for help

sick hound
#

this is probably one of the worst places to ask for help lmfao

grave rover
#

yup

#

except for things like what I asked for

#

oh wait i see

#

the parameter to that isn't the number of arguments but flags

cloud fossil
#

this JTP guy posted this question on every channel here

grave rover
#

or is it

#

uhhh

#

wait no it is the number of args

#

oh my god I knew i'd seen this before

#

co_nlocals was the wrong size

grave rover
#

can someone explain to me why co_nlocals is useful if you could also just check PyTuple_GET_SIZE(co_varnames)

violet swallow
#

df = pd.read_csv("")
using this to get csv from a directory and using it in a panda dataframe.
what i want to do is, get all csv inside that directory in a list or something, so i can run a loop in the above function. and use them 1 by 1.
all files has similar initial naming.
For eg: xyz- is common below
xyz-abc
xyz-def
xyz-abc2

restive rampart
#

!e

l = ["abc", "def", "def2"]
for i in l:
    print(f"xyz-{i}")
night quarryBOT
#

@restive rampart :white_check_mark: Your eval job has completed with return code 0.

001 | xyz-abc
002 | xyz-def
003 | xyz-def2
violet swallow
#

This was eg.
File name are bigger and there is 40-50 CSV.

#

Something like
xyz-* I am looking for but unable to find the solution.

restive rampart
#

Look into this

#

you can loop through all the available .csv files in a directory

#

using glob

violet swallow
#

@restive rampart ty

#

Made it work.
Had a few issues earlier.

cloud fossil
#

wanted to post here an esoteric C code but then I read the channel's name.

#

actually it's not so esoteric, just compact and very optimized

terse mortar
#

Maybe not the optimized part but...

proper vault
#

this channel is specifically for python

sudden willow
#

im sure a bit of C code never hurt anyone @cloud fossil

cloud fossil
#

a bit of C code was deleted from this channel, probably by lakmatiol

sudden willow
#

:/

ornate spire
#

!e

from random import choice
from math import log


def basic_num(num):
    a = ["__name__.__len__().__bool__()"]
    c = ["__doc__.__bool__().__int__()"]
    if num == 0:
        return choice(c)

    b = [choice(a) for _ in range(num)]
    return b.pop(0) + ''.join(map(lambda x: f".__add__({x})", b))


def optimised_num(num):
    a = []

    while num > 5:
        pows = [int(log(num) / log(i)) for i in range(2, 6)]
        nums = [(i + 2) ** j for i, j in enumerate(pows)]
        max_ = max(nums)
        num -= max_

        i = nums.index(max_)
        a.append(f"{optimised_num(i + 2)}.__pow__({optimised_num(pows[i])})")

    a.append(basic_num(num))
    return a.pop(0) + ''.join(map(lambda x: f".__add__({x})", a))


def convert_string(word):
    a = [f"chr({optimised_num(ord(i))})" for i in word]
    return a.pop(0) + ''.join(map(lambda x: f".__add__({x})", a))



a = convert_string("print('Hello World!')")
print(eval(a))
print(a)
night quarryBOT
#

@ornate spire :white_check_mark: Your eval job has completed with return code 0.

001 | print('Hello World!')
002 | chr(__name__.__len__().__bool__().__add__(__name__.__len__().__bool__()).__add__(__name__.__len__().__bool__()).__pow__(__name__.__len__().__bool__().__add__(__name__.__len__().__bool__()).__add__(__name__.__len__().__bool__()).__add__(__name__.__len__().__bool__())).__add__(__name__.__len__().__bool__().__add__(__name__.__len__().__bool__()).__add__(__name__.__len__().__bool__()).__pow__(__name__.__len__().__bool__().__add__(__name__.__len__().__bool__()).__add__(__name__.__len__().__bool__()))).__add__(__name__.__len__().__bool__().__add__(__name__.__len__().__bool__()).__add__(__name__.__len__().__bool__()).__add__(__name__.__len__().__bool__()))).__add__(chr(__name__.__len__().__bool__().__add__(__name__.__len__().__bool__()).__add__(__name__.__len__().__bool__()).__pow__(__name__.__len__().__bool__().__add__(__name__.__len__().__bool__()).__add__(__name__.__len__().__bool__()).__add__(__name__.__len__().__bool__())).__add__(__name__.__len__().__bo
... (truncated - too long)

Full output: too long to upload

sick hound
#

hey that's my dunder thing

languid wigeon
#

!e

marsh void
#

@rugged sparrow hey, uhm, I asked already but perhaps need to ask again; wanted to peek at the source of access_control thingy you were working on yesterday

grave rover
#

@marsh void I'm gonna guess the parent constructor does a check for property annotations, turns them into propertys and checks the stack in the setter/getter

rugged sparrow
#

@grave rover yea you guessed it

#

@marsh void gimme a min ill send a link

grave rover
rugged sparrow
#

to make a controlled class make it inherit from AccessControl

#

and put all the attributes you want protected at the top as annotations

#

like py class Foo(AccessControl): private: PRIVATE protected: PROTECTED | FINAL

#

making methods protected works, as does making protected @propertys but i wouldnt use it in production ever

snow beacon
#

+ might look better than |.

rugged sparrow
#

i did it like that cause i use them as flags if prot & PRIVATE: ...

#

so it made sense to use |

snow beacon
#

And I suppose with + it's no longer idempotent.

rugged sparrow
#

to be fair + does work but i think | is clearer imo

snow beacon
#

PROTECTED + PROTECTED = PUBLIC, which might not be for the best.

rugged sparrow
#

yea that wouldnt be great

#

to be fair you can change the protections on an attribute by setting cls.attr.fget.__closure__[idx of int closure].cell_contents

grave rover
#

I've been thinking of this challenge where you have flags, but you bit-and them instead of using bit-or
so PROTECTED | FINAL -> PROTECTED & FINAL
each combination needs to still be unique, but their actual values don't mind
what would be the rules for generating such flags' values?

snow beacon
#

They'd just be ~ of the normal flags.

#

1101 instead of 0010 effectively.

#

It's De Morgan's Law.

grave rover
#

but then how can you check if a value includes a certain flag

snow beacon
#

You'd OR it with a certain flag, then NOT it, I think.

grave rover
#

flags & my_flag != 0?

snow beacon
#

flags | my_flag != -1

grave rover
snow beacon
#

You might need to use ~c.

grave rover
#

oh yeah that works

#

crazy how math be like that

snow beacon
#

This symmetry is De Morgan's Law. It's basically "A or B is not(not A and not B)".

#

That's for Boolean algebra, but it works for sets and binary too.

grave rover
#

anyways imma head to bed, got a lot of bytecode hacking done today yay

terse mortar
#

!e ```py
print("not rly useful but still cursed\n", ([].len().bool().str().len()).add([1].len().bool().str().len()).truediv(2))

night quarryBOT
#

@terse mortar :white_check_mark: Your eval job has completed with return code 0.

001 | not rly useful but still cursed
002 | 
003 | 4.5
sudden willow
#

why not this

#

!e

__import__("sys").stdout.write((([].__len__().__bool__().__str__().__len__()).__add__([__debug__.__bool__().__int__()].__len__().__bool__().__str__().__len__()).__truediv__(__debug__.__bool__().__int__().__add__(__debug__.__bool__().__int__()))).__str__())
#

o

night quarryBOT
#

@sudden willow :white_check_mark: Your eval job has completed with return code 0.

4.5
sick hound
#

what's __truediv__ ?

steep mural
#

__truediv__ is called when the / operator is used... a/b, __floordiv__ is called when the // operator is used... a//b. For integers and floats this is regular division but __floordiv__ returns the "floored" result

fluid tree
little swan
#

I found this on stack overflow:

import re

def findWholeWord(w):
    return re.compile(r'\b({0})\b'.format(w), flags=re.IGNORECASE).search

findWholeWord('seek')('those who seek shall find')    # -> <match object>
findWholeWord('word')('swordsmith')                   # -> None

Does anyone know what this functionality is called where you call a function like this function(parameter)(more parameters?). Not sure if its really esoteric but i never seen it before and would like to learn more about it.

proper vault
#

to an extent, it could be called currying

#

but really, it's just using the fact python has first class functions

little swan
proper vault
#

a function can return another function

#

a simpler example would be

#
def fun():
    print('hello')
def bar():
    return fun
bar()()
grave rover
#
# After mixins:
# 'head inject'
# 'head cancel'
# => return 2
def head_target():
    print("head_target")


@inject(head_target, at=At(InjectionPoint.HEAD), cancellable=True)
def inject_head_cancel(cir: CallbackInfoReturnable):
    print("head cancel")
    cir.set_return(2)


@inject(head_target, at=At(InjectionPoint.HEAD),
        priority=10)  # Run before cancel
def inject_head(ci: CallbackInfo):
    print("head inject")
``` this now works, nice
thin trout
grave rover
#

shhh

#

I've already made sure this won't segfault on marshal-generated code, dw

#

I can also inject at any return, before loading a certain constant, and at the last return only

#

injecting before function calls is a bit more difficult sadly

#

since i need to quite literally look at how the stack behaves

terse mortar
#

!e py __builtins__.__dict__[__builtins__.__dir__()[().__class__.__name__.__len__().__rmul__(__debug__.__add__(__debug__)).__rmul__({}.__class__.__name__.__len__())]]((([].__len__().__bool__().__str__().__len__()).__add__([__debug__.__bool__().__int__()].__len__().__bool__().__str__().__len__()).__truediv__(__debug__.__bool__().__int__().__add__(__debug__.__bool__().__int__()))).__str__()) I made what I did yesterday worse

night quarryBOT
#

@terse mortar :white_check_mark: Your eval job has completed with return code 0.

4.5
sick hound
#

wack

#

wait

#

the fuck

#

[]

#

is this

terse mortar
#

an empty list

sick hound
#

you're trying to get a 1

#

???

terse mortar
#

no, i wanted to get 0

#

!e print([].len())

sick hound
#

[].__len__().__bool__().__str__().__len__()

#

wait no this is a 4

night quarryBOT
#

@terse mortar :white_check_mark: Your eval job has completed with return code 0.

0
terse mortar
#

i think

sick hound
#

wait

#

fuck

#

i can't count

#

alright

#

not fully using dunders sMh

terse mortar
#

!e ```py
print([].len().bool().str().len())

night quarryBOT
#

@terse mortar :white_check_mark: Your eval job has completed with return code 0.

5
sick hound
#

!e print(doc.bool())

terse mortar
sick hound
#

!e print(name.len().bool())

terse mortar
#

ahh cool

sick hound
#

wait i need to try somethign

#

!e print(doc.bool().invert())

#

the fuck

#

!e print(bin(False))

night quarryBOT
#

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

0b0
sick hound
#

!e print(bin(-1))

#

wait oh 1b1

tribal moon
#

invert is just the number number * -2 I think

sick hound
#

!e

x = 2
print(bin(x))
print(bin(x.__invert__()))```
night quarryBOT
#

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

001 | 0b10
002 | -0b11
sick hound
#

dafq

terse mortar
#

ok ima just leave this here

#

!e ```py
for x in (type('While',(),{'iter': lambda self: self, 'next': lambda self: "Infinite"}))():(_:='One Piece Is The Greatest');builtins.dict[builtins.dir()[().class.name.len().rmul(debug.add(debug)).rmul({}.class.name.len())]]("".join(chr(ord(__)) for __ in _))

night quarryBOT
#

@terse mortar :x: Your eval job timed out or ran out of memory.

001 | One Piece Is The Greatest
002 | One Piece Is The Greatest
003 | One Piece Is The Greatest
004 | One Piece Is The Greatest
005 | One Piece Is The Greatest
006 | One Piece Is The Greatest
007 | One Piece Is The Greatest
008 | One Piece Is The Greatest
009 | One Piece Is The Greatest
010 | One Piece Is The Greatest
011 | One Piece Is The Greatest
... (truncated - too many lines)

Full output: too long to upload

terse mortar
#

oneliner cursed thingy

sick hound
#

!e for x in __import__("itertools").count(1): print("eee")

tribal moon
#

we have a lambda one liner, dunder one linder, and one liner, what else?

night quarryBOT
#

@sick hound :x: Your eval job timed out or ran out of memory.

001 | eee
002 | eee
003 | eee
004 | eee
005 | eee
006 | eee
007 | eee
008 | eee
009 | eee
010 | eee
011 | eee
... (truncated - too many lines)

Full output: too long to upload

sick hound
#

kek

tribal moon
#

is there any other way to make an obfuscator

#

we already have dunders and lambdas done

sick hound
#

yes

tribal moon
#

what else?

sick hound
#

exec(eval(str of program))

terse mortar
#

wont that just return none?

sick hound
#

str of the program

tribal moon
#

that's not obfuscated

sick hound
#

close enough there's too many fucking dunders to count

terse mortar
#

!e exec(eval("print('Hello, World!')"))

night quarryBOT
#

@terse mortar :x: Your eval job has completed with return code 1.

001 | Hello, World!
002 | Traceback (most recent call last):
003 |   File "<string>", line 1, in <module>
004 | TypeError: exec() arg 1 must be a string, bytes or code object
#

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

tribal moon
#

also don't use exec

sick hound
#

fuck

tribal moon
#

use py __builtins__.__dict__[__builtins__.__dir__()[(lambda _, __, ___, ____, _____, ______, _______, ________, _________, __________: _).__code__.co_nlocals*(lambda _, __: _).__code__.co_nlocals]]

#

this is better

terse mortar
#

i made a dunder list the other day

sick hound
#

uh

#

the fuck

#

what's eval then

tribal moon
#

idk

sick hound
#

kek

tribal moon
#

I can generate it for you

sick hound
#

but this

tribal moon
#

but it's gonna be long

sick hound
#

wrap it in an exec(eval())

#

and valid code

terse mortar
#

dude why

sick hound
#

why not

#

you don't need an eval()

#

if it aint a string

#

too

terse mortar
#

i forgot what channel i was in LOL

sick hound
#

lmfao

tribal moon
#

That's really cool

#

I like your dunder obfuscator

#

you should add black to it now

sick hound
#

black?

#

what

tribal moon
#

!paste

night quarryBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

tribal moon
thin trout
tribal moon
#

that went under black

#

it's what my obfuscator uses

terse mortar
elfin onyx
#

!e

for x in (type('While',(),{'__iter__': lambda self: self, '__next__': lambda self: "Infinite"}))():(_:='One Piece Is The Greatest');__builtins__.__dict__[__builtins__.__dir__()[().__class__.__name__.__len__().__rmul__(__debug__.__add__(__debug__)).__rmul__({}.__class__.__name__.__len__())]]("".join(chr(ord(__)) for __ in _))
night quarryBOT
#

@elfin onyx :x: Your eval job timed out or ran out of memory.

001 | One Piece Is The Greatest
002 | One Piece Is The Greatest
003 | One Piece Is The Greatest
004 | One Piece Is The Greatest
005 | One Piece Is The Greatest
006 | One Piece Is The Greatest
007 | One Piece Is The Greatest
008 | One Piece Is The Greatest
009 | One Piece Is The Greatest
010 | One Piece Is The Greatest
011 | One Piece Is The Greatest
... (truncated - too many lines)

Full output: too long to upload

sick hound
#

wack

tribal moon
#

is there a way to use self in a class with type

#

because isn't the first argument the self part?

elfin onyx
sick hound
#
a=input("input a number: " )
a = int(a)
print(a)
a = a + 1
print(a)```
terse mortar
tribal moon
#

lol

sick hound
#

i could also do that one chr

#

thing

#

but i'm lazy

#

but it's literally 1 copy paste

tribal moon
#

I think I wrote one for chr

terse mortar
#

yeah, arent we all

tribal moon
#

it's all the way up now

sick hound
#

i think you did

#

too lazy to scroll

tribal moon
#

what is chr in your dunder obfuscator

#

a string

sick hound
#

just chr

tribal moon
#

do you wanna know how to write dunder keywords

sick hound
#

um what

tribal moon
#

it's pretty easy

sick hound
#

?

tribal moon
#
>>> __builtins__.__dir__().index("chr")
14
>>> __debug__.__add__(__debug__).__rmul__(__debug__.__add__(__debug__)).__add__({__debug__}.__class__.__name__.__len__()).__rmul__(__debug__.__add__(__debug__))
14
>>> __builtins__.__dict__[__builtins__.__dir__()[__debug__.__add__(__debug__).__rmul__(__debug__.__add__(__debug__)).__add__({__debug__}.__class__.__name__.__len__()).__rmul__(__debug__.__add__(__debug__))]]
<built-in function chr>
>>> 
#

like that

#

!e py print("Dunder Chr of A") print(__builtins__.__dict__[__builtins__.__dir__()[__debug__.__add__(__debug__).__rmul__(__debug__.__add__(__debug__)).__add__({__debug__}.__class__.__name__.__len__()).__rmul__(__debug__.__add__(__debug__))]](65))

night quarryBOT
#

@tribal moon :white_check_mark: Your eval job has completed with return code 0.

001 | Dunder Chr of A
002 | A
terse mortar
night quarryBOT
#

@terse mortar :white_check_mark: Your eval job has completed with return code 0.

Hello, World!
tribal moon
terse mortar
#

ohh

tribal moon
#

that's how it works

#

it encodes it in base64 by the way

#

because all it can do is letters

#

but it's really bad it takes up a lot of space

#

a simple hello world program in Oof's dunder generator would be like a million lines in this one lol

#

I have to optimize it

terse mortar
#

optimize a deoptimizer

tribal moon
#

LOL

terse mortar
#

better yet: run the source code in the generator itself!

#

also i really hope you arent running that on your real pc

sick hound
#

wack

tribal moon
#

I am lol

#

I don't run it anymore

#

it's too bad

#

like a tic tac toe program took 20k lines

sick hound
#

.

#

you what

shy remnant
#

!e

(lambda i: [print(chr(x),end='') for x in (lambda i=i: [globals().update({"h":(lambda _=(i[-1]+i[2]): (_*_)+i[3])()}) or h,h - i[2],globals().update({"l":h + i[3]}) or l,l,globals().update({"o":l + i[2]}) or o,(i[-1] + i[0]) * 4,o + (i[3] * 2),o,o + i[2],l,h - i[3],i[4] * 2])()])([_.__code__.co_argcount for _ in ((lambda _: None),(lambda _, __: None),(lambda _, __, ___: None),(lambda _, __, ___, ____: None),(lambda _, __, ___, ____, _____: None),(lambda _, __, ___, ____, _____, ______: None),(lambda _, __, ___, ____, _____, ______, _______: None))])
night quarryBOT
#

@shy remnant :white_check_mark: Your eval job has completed with return code 0.

hello world
halcyon zinc
#

wtf

#

!e
(lambda i: [print(chr(x),end='') for x in (lambda i=i: [globals().update({"h":(lambda _=(i[-1]+i[2]): (_*_)+i[3])()}) or h,h - i[2],globals().update({"l":h + i[3]}) or l,l,globals().update({"o":l + i[2]}) or o,(i[-1] + i[0]) * 4,o + (i[3] * 2),o,o + i[2],l,h - i[3],i[4] * 2])()])([_.__code__.co_argcount for _ in ((lambda _: None),(lambda _, __: None),(lambda _, __, ___: None),(lambda _, __, ___, ____: None),(lambda _, __, ___, ____, _____: None),(lambda _, __, ___, ____, _____, ______: None),(lambda _, __, ___, ____, _____, ______, _______: None))])

night quarryBOT
#

@halcyon zinc :white_check_mark: Your eval job has completed with return code 0.

hello world
sick hound
#

magic

#

lmfao

rugged sparrow
#

just realized that my goto implementation lets me write loops like this py f = lambda:int(i) if label .start or (i:=input('type a number: ')).isnumeric() else goto .start ```py

n = f()
type a number: no
type a number: 123a
type a number: 123
print(n)
123
type(n)
<class 'int'>

naive roost
#

well, interesting to see

rugged sparrow
#

honestly i thought it would break my bytecode patcher

naive roost
#

well, good if it doesn't

sick hound
#

wait how do you have a bytecode patcher

#

also gotos

sudden willow
#

you guys ever heard of unlambda?

#

r``\``\``\``\``\`.h.e.l.l.o. .w.o.r.l.di

#

this is the hello world statement without the backspaces

#

been trying to figure out how to implement this into my python code

rugged sparrow
#

!e ```py
from ctypes import c_char
def getmem(addr, size):
return memoryview((c_char*size).from_address(addr)).cast('B')

all = ['goto', 'label']

def getframe(depth=0):
try:raise
except Exception as e:
frame = e.traceback.tb_frame
for _ in range(depth + 1):
frame = frame.f_back
return frame

def get_dest(frame, label):
code, names = frame.f_code.co_code, frame.f_code.co_names
frame_var = {**frame.f_globals, **frame.f_locals}.get
ops, args = code[::2], code[1::2]
for idx, (op, arg) in enumerate(zip(ops, args)):
if op == 106 and names[arg] == label and
isinstance(frame_var(names[args[idx - 1]]), Label):
return (idx - 1) * 2
raise RuntimeError(f'label {label!r} not found')

def set_instr(code, idx, op, arg):
code_addr = id(code) + bytes.basicsize - 1
mem = getmem(code_addr, len(code))
(op, arg), mem[idx:idx + 2] = mem[idx:idx + 2], bytes((op, arg))
return op, arg

restore_instr = [None, None, None]

class Goto:
def getattr(self, label):
code = (frame := getframe(1)).f_code.co_code
idx = frame.f_lasti + 2
op, arg = set_instr(code, idx, 114, get_dest(frame, label))
restore_instr[:3] = (idx, op, arg)
mul = getattr

class Label:
def getattr(self, name):
if None not in restore_instr:
frame = getframe(1)
set_instr(frame.f_code.co_code, *restore_instr)
restore_instr[:3] = (None, None, None)

goto = Goto()
label = Label()

x = 0
label .start
print(x)
if x == 10:
goto .end
x += 1
goto .start
label .end```

night quarryBOT
#

@rugged sparrow :white_check_mark: Your eval job has completed with return code 0.

001 | 0
002 | 1
003 | 2
004 | 3
005 | 4
006 | 5
007 | 6
008 | 7
009 | 8
010 | 9
011 | 10
rugged sparrow
#

@sick hound ^ thats how i have goto

toxic jewel
night quarryBOT
#
Did you mean ...

exit()
environments
enumerate
except

#

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

001 |   File "<string>", line 1
002 |     (_:=lambda _:(_ := _.__add__(__name__.__len__().__bool__().__int__()))
003 |                                                                           ^
004 | SyntaxError: unexpected EOF while parsing
night quarryBOT
#

Hey @robust aspen!

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

robust aspen
#

recursive optimization does wonders

#

3k characters

boreal slate
#
def f(x):
 s={}
 for n in x:
  if n not in s:s[n]=1
  else:
   k=s[n]
   while(z:=f"{n}({k})")in s:k+=1
   s[n]=k+1;s[z]=1
 return list(s.keys())
print(f(["doc", "doc", "image", "doc(1)", "doc"]))
``` anyway to shortern this?
hard spoke
#

hmm, if you use a defaultdict for s, you won't need to set default values to 1 manually

snow beacon
#

Or you could use k=s.get(n,0). At least, I think that's the function.

#

No if means less indentation.

last locust
#

Don't think you need the .keys() in list(s.keys()) either```py

x = {'a': 1, 'b': 2, 'c': 3}
list(x.keys())
['a', 'b', 'c']
list(x)
['a', 'b', 'c']```

#
n+f"({k})"```also saves 1 char
boreal slate
#

ah yes,

boreal slate
snow beacon
#

I forgot the +1.

#

Oh, I see.

#

Touchรฉ.

stark fable
#
  if n not in s:s[n]=1
  else:
   k=s[n]
   while(z:=f"{n}({k})")in s:k+=1
   s[n]=k+1;s[z]=1``` why not swap the order here to avoid a `not`
#

so py if n in s: k=s[n] while(z:=f"{n}({k})")in s:k+=1 s[n]=k+1;s[z]=1 else:s[n]=1

last locust
thin trout
#

Sad

distant wave
#

Huh.

thin trout
#

Still sad

distant wave
#

I am an idiot

thin trout
#

r-word lemon_enraged

distant wave
#

Fixed

thin trout
#

Nice

distant wave
#

!e ```py
import inspect
import sys
from importlib.machinery import PathFinder

class LogImporter(PathFinder):
def init(self, print_file_path: bool = False):
self.print_file_path = print_file_path

def find_spec(self, name, path=None, target=None):
    print('Importing', name, end=" ", flush=True)
    cf = inspect.currentframe().f_back
    a = 0
    while cf:
        a += 1
        # Handle non-file frames
        if "__file__" not in cf.f_globals:
            print("Exec() frame", cf.f_code.co_name, cf.f_code.co_filename)
            cf = cf.f_back
            continue
        # Skip import machinery
        if "importlib" in cf.f_globals['__file__']:
            cf = cf.f_back
            continue
        # Print the file path or just the filename
        if not self.print_file_path:
            print(a, "from file", '/'.join(cf.f_globals['__file__'].rsplit("/")[-2:]))
        else:
            print(a, "from file", cf.f_globals['__file__'])
        break
    # clean up our frames explicitly
    del cf
    # Engage the rest of the import system
    return super().find_spec(name, path, target)

sys.meta_path.insert(0, LogImporter())

import json
print(json)

night quarryBOT
#

@distant wave :white_check_mark: Your eval job has completed with return code 0.

001 | Importing json Exec() frame <module> <string>
002 | Importing json.decoder 4 from file json/__init__.py
003 | Importing json.scanner 6 from file json/decoder.py
004 | Importing _json 4 from file json/scanner.py
005 | Importing json.encoder 4 from file json/__init__.py
006 | <module 'json' from '/usr/local/lib/python3.9/json/__init__.py'>
terse mortar
#

!e ```py
print(().class.name.str()[::-(().class.name.str().len().sub([1].len().bool().str().len()).sub(().class.name.str().len().sub(().class.name.str().len().sub([1].len().bool().str().len()).sub(().class.name.str().len().sub([1].len().bool().str().len()).sub(().class.name.str().len().sub([1].len().bool().str().len()).sub(().class.name.str().len().sub([1].len().bool().str().len()).sub(().class.name.str().len().sub([1].len().bool().str().len()).sub(().class.name.str().len().sub([1].len().bool().str().len()).sub(().class.name.str().len().sub([1].len().bool().str().len()))))))))))])

night quarryBOT
#

@terse mortar :white_check_mark: Your eval job has completed with return code 0.

tl
tribal moon
#

replace all the 1s with __debug__

toxic jewel
#

hmm

#

anyone know an equivalent dunder thingy for 0?

#

right now im using this

#

__debug__.__bool__().__str__().__len__().__int__().__sub__(__debug__.__bool__().__str__().__len__().__int__())]

terse mortar
toxic jewel
#

ik but never hurts to add some length

#

especially since im making an obfuscator and i need to get rid of any chance of readability

#

im currently using this for E

#

!e

print(....__class__().__str__()[__debug__.__bool__().__str__().__len__().__int__().__sub__(__debug__.__bool__().__str__().__len__().__int__())])
night quarryBOT
#

@toxic jewel :white_check_mark: Your eval job has completed with return code 0.

E
tribal moon
#

if you're making an obfuscator it should be better for it to be as small as possible

#

the size doesn't really matter for readability

toxic jewel
#

nvm found what i was looking for

#

__doc__.__bool__().__int__()

#

!e

print(
    ....__class__().__str__()[__doc__.__bool__().__int__()]
)
night quarryBOT
#

@toxic jewel :white_check_mark: Your eval job has completed with return code 0.

E
toxic jewel
#

much cleaner

naive roost
#

if you start Python with -O or -OO, __debug__ will be false

tribal moon
#

ok

toxic jewel
#

!e __import__("sys").stdout.write(__doc__.__dir__())

night quarryBOT
#

@toxic jewel :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | TypeError: write() argument must be str, not list
toxic jewel
#

none returns 0 correct?

naive roost
#

None evaluates to False when needed

twilit grotto
#

"when needed" is a bit of an oversimplification lol

#

bool(None) == False

toxic jewel
#

!e print(__doc__.__class__().__bool__().__int__())

night quarryBOT
#

@toxic jewel :white_check_mark: Your eval job has completed with return code 0.

0
toxic jewel
#

pog

naive roost
#

I did not really know how to express it anymore ๐Ÿ˜…

toxic jewel
#

!e

print(
    ....__class__().__str__()[__doc__.__class__().__bool__().__int__()],
    __debug__.__bool__().__str__()[-(__name__.__len__().__bool__().__int__())], sep="\n"
)
night quarryBOT
#

@toxic jewel :white_check_mark: Your eval job has completed with return code 0.

001 | E
002 | e
toxic jewel
#

perrrrrfect

snow beacon
#

Another way to say it is that None is falsey.

toxic jewel
#

is __hash__() random?

twilit grotto
#

in cpython yeah

naive roost
#

at least it is salted, and the salt changes between interpreter runs

#

that prevents malicious attacks on the worst case of dict insertion (security issues)

#

though the salt is always the same inside a Python interpreter's lifetime

toxic jewel
#

wonder how i can get 1 from 0

tribal moon
#

0 .__invert__().__abs__() do you mean this?

toxic jewel
#

you can do that???

#

thats crazy

#

!e

print(....__class__().__hash__().__str__().__len__().__floordiv__(....__class__().__hash__().__str__().__len__()))
night quarryBOT
#

@toxic jewel :white_check_mark: Your eval job has completed with return code 0.

1
toxic jewel
#

tryna make a list of integers

#

!e

(
    zero := (__doc__.__bool__().__int__()),
    one := (__doc__.__bool__().__int__()).__invert__().__abs__(),
    two := (__name__.__len__().__bool__().__int__().__add__(__name__.__len__().__bool__().__int__())),
    three := (__debug__.__str__().__len__().__sub__(__debug__.__int__()))
)
print(zero, one, two, three)
night quarryBOT
#

@toxic jewel :white_check_mark: Your eval job has completed with return code 0.

0 1 2 3
toxic jewel
#

heres what i have so far

#

any tips

#

trying not to use any of the same techniques in any

tribal moon
#

for 4 you can do {}.__class__.__name__.__len__()

#

for 5 you can do (__name__,).__class__.__name__.__len__()

frigid wharf
#
four = ....__class__.__name__.__len__().__rshift__(....__class__.__base__().__sizeof__().__bool__())
six = ().__class__.__base__.__name__.__len__()
robust aspen
#

for 4 I got [[]].__str__().__len__()

#

and just removing and adding the brackets as needed

snow beacon
robust aspen
#

!e

(__builtins__.__dict__['globals']().__setitem__('__',[].__len__()),__builtins__.__dict__['globals']().__setitem__('___',__debug__.__int__()),__builtins__.__dict__['list'](__builtins__.__dict__['map'](lambda _:[(__builtins__.__dict__['print'](__),__builtins__.__dict__['globals']().__setitem__('____',__.__add__(___)),__builtins__.__dict__['globals']().__setitem__('__', ___),__builtins__.__dict__['globals']().__setitem__('___',____))], [__]*__name__.__len__().__lshift__(__debug__))))
night quarryBOT
#

@robust aspen :white_check_mark: Your eval job has completed with return code 0.

001 | 0
002 | 1
003 | 1
004 | 2
005 | 3
006 | 5
007 | 8
008 | 13
009 | 21
010 | 34
011 | 55
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/oyibuwolat.txt

robust aspen
#

that was fun

toxic jewel
#

!e
print({}.__class__.__name__)

night quarryBOT
#

@toxic jewel :white_check_mark: Your eval job has completed with return code 0.

dict
toxic jewel
#

very smart

night quarryBOT
#

@toxic jewel :white_check_mark: Your eval job has completed with return code 0.

str
toxic jewel
#

!e
print(''.__str__().__class__.__name__)

night quarryBOT
#

@toxic jewel :white_check_mark: Your eval job has completed with return code 0.

str
floral meteor
#

!e ```py
class Aaaaaa(float):
def init(self,value):self.value=value;self.dec=0;super().init()
def getattr(self,attr):
if attr in dir(float()):return super().getattr(attr)
elif attr=='point':self.dec=1 if not self.dec else self.dec
elif self.dec:self.dec+=1;return self+{"one":1,"two":2,"three":3,"four":4,"five":5,"six":6,"seven":7,"eight":8,"nine":9,"zero":0}[attr]*(10**(-self.dec+1))
return self
four_hundred_and_twenty=Aaaaaa(420)
print(four_hundred_and_twenty.point.seven.eight)

snow beacon
#

From memory you can also edit the actual exit object's attributes, unlike many other Python things.

night quarryBOT
#

@floral meteor :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 9, in <module>
003 | AttributeError: 'float' object has no attribute 'eight'
floral meteor
#

why my code break at second decimal place?

rugged sparrow
#

@floral meteor what do you mean

floral meteor
#

the Aaaaaa class getattr method holds until four_hundred_and_twenty.point.seven.eight is attempted, at which point it claims that the float object has no attribute eight even though i explicitly told it how to handle attribute not found error

rugged sparrow
#
>>> a=Aaaaaa(420)
>>> type(a.point)
<class '__main__.Aaaaaa'>
>>> type(a.point.seven)
<class 'float'>
>>> ```
robust aspen
#

your returning a float

#

The way I did it is just adding __call__

floral meteor
#
class Aaaaaa(float):
    def __init__(self,value,dec=0):self.value=value;self.dec=dec;super().__init__()
    def __getattr__(self,attr):
      if attr in dir(float()):return super().__getattr__(attr)
      elif attr=='point':self.dec=1 if not self.dec else self.dec
      elif self.dec:return Aaaaaa(self+{"one":1,"two":2,"three":3,"four":4,"five":5,"six":6,"seven":7,"eight":8,"nine":9,"zero":0}[attr]*(10**(-self.dec+1)),dec=self.dec+1)
      return self
four_hundred_and_twenty=Aaaaaa(420)
print(four_hundred_and_twenty.point.seven.eight.six.six)
#

!e ```py
class Aaaaaa(float):
def init(self,value,dec=0):self.value=value;self.dec=dec;super().init()
def getattr(self,attr):
if attr in dir(float()):return super().getattr(attr)
elif attr=='point':self.dec=1 if not self.dec else self.dec
elif self.dec:return Aaaaaa(self+{"one":1,"two":2,"three":3,"four":4,"five":5,"six":6,"seven":7,"eight":8,"nine":9,"zero":0}[attr]*(10**(-self.dec+1)),dec=self.dec+1)
return self
four_hundred_and_twenty=Aaaaaa(420)
print(four_hundred_and_twenty.point.seven.eight.six.six)

night quarryBOT
#

@floral meteor :white_check_mark: Your eval job has completed with return code 0.

427.866
floral meteor
#

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

#

!e ```py
class Aaaaaa(float):
def init(self,value,dec=0):self.value=value;self.dec=dec;super().init()
def getattr(self,attr):
if attr in dir(float()):return super().getattr(attr)
elif attr=='point':self.dec=1 if not self.dec else self.dec
elif self.dec:return Aaaaaa(self+{"one":1,"two":2,"three":3,"four":4,"five":5,"six":6,"seven":7,"eight":8,"nine":9,"zero":0}[attr]*(10**(-self.dec)),dec=self.dec+1)
return self
four_hundred_and_twenty=Aaaaaa(420)
print(four_hundred_and_twenty.point.seven.eight.six.six)

night quarryBOT
#

@floral meteor :white_check_mark: Your eval job has completed with return code 0.

420.78659999999996
floral meteor
#

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

#

aha

#

!e ```py
class Aaaaaa(float):
def init(self,value,dec=0):self.value=value;self.dec=dec;super().init()
def getattr(self,attr):
if attr in dir(float()):return super().getattr(attr)
elif attr=='point':self.dec=1 if not self.dec else self.dec
elif self.dec:return Aaaaaa(round(self+{"one":1,"two":2,"three":3,"four":4,"five":5,"six":6,"seven":7,"eight":8,"nine":9,"zero":0}[attr]*(10**(-self.dec)),self.dec+1),dec=self.dec+1)
return self
four_hundred_and_twenty=Aaaaaa(420)
print(four_hundred_and_twenty.point.seven.eight.six.six)

night quarryBOT
#

@floral meteor :white_check_mark: Your eval job has completed with return code 0.

420.7866
floral meteor
#

ahahahahahahahahahahahahahahahahahahahahaha i am invincible

#

alright i need to reverse engineer my own cipher to get the key given a token and the encrypted token.
I have...

def enigma_de(source:str,key:str):
    """algorithm to decrypt substitution cipher.
e.g. t,F => N
    """
    if len(source)<len(key):key=key[:len(source)]                           # wrap key to match source size
    elif len(source)>len(key):key=(key*(len(source)//len(key)+1))[:len(source)]
    _s=[ord(c)for c in list(source)];_k=[ord(c)for c in list(key)];_p=[]    # init
    for i,e in enumerate(_s):_p.append((((e-32)-(_k[i]-32))%95)+32)         # <-- decryption algorithm
    return''.join([chr(n)for n in _p])                                     # return token
def enigma_en(source:str,key:str):
    """algorithm to encrypt substitution cipher.
e.g. N+F => t
    """
    if len(source)<len(key):key=key[:len(source)]                           # wrap key without requiring itertools
    elif len(source)>len(key):key=(key*(len(source)//len(key)+1))[:len(source)]
    _s=[ord(c)for c in list(source)];_k=[ord(c)for c in list(key)];_p=[]    # encode (_s,_k) and initialise variables (_s,_k,_p)
    for i,e in enumerate(_s):_p.append((((e-32)+(_k[i]-32))%95)+32)         # encrypt raw data
    return''.join([chr(n)for n in _p])                                     # decode _p and return it****

given that's the cipher, how would I, after evaluating...

>>> secret = "shh this is a secret"
>>> gobbledygook = enigma_en(secret,"P455w0rd1")

... get "P455w0rd1" from some function of secret and gobbledygook ?

#

but don't tell me the straight answer

#

I just need help thonking of me own answer

#

if no one says anything i'm kinda just gonna keep rambling until i figure it out on me own

#

:P

#

!e ```py
{print(int("9"*20)**int("9"*20))for _ in iter(int,1)}

night quarryBOT
#

@floral meteor :warning: Your eval job timed out or ran out of memory.

[No output]
floral meteor
#

aw that all

#

i got... ```nim
File "<string>", line 1, in <module>
KeyboardInterrupt
Exception in thread Thread-2:
Fatal Python error: _enter_buffered_busy: could not acquire lock for <_io.BufferedWriter name='<stderr>'> at interpreter shutdown, possibly due to daemon threads
Python runtime state: finalizing (tstate=000002D8773C38B0)

Current thread 0x000042fc (most recent call first):
<no Python frame>

B:>

#

you can't really evaluate keyboard interrupting that i guess

rugged sparrow
#

what was the code that caused that error?

toxic jewel
#

what does .__rshift__() do?

astral rover
#

support the >> operator

toxic jewel
#

ah

#

!e

print({}.__class__().__hash__().__int__().__rshift__(__debug__.__add__(__debug__.__mul__(__debug__.__add__(__debug__)))))
night quarryBOT
#

@toxic jewel :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | TypeError: 'NoneType' object is not callable
toxic jewel
#

huh

#

!e
print({}.__class__().__str__().__hash__())

night quarryBOT
#

@toxic jewel :white_check_mark: Your eval job has completed with return code 0.

4578586700643154856
toxic jewel
#

oh

proper vault
#

dicts are not hashable

toxic jewel
#

converting the word dict to a str to hash it

#

trollar

#

recreating random.randint but it only works from 50-60 something and its almost always 63

#

!e

print({}.__class__().__str__().__hash__().bit_length())
night quarryBOT
#

@toxic jewel :white_check_mark: Your eval job has completed with return code 0.

63
limpid slate
#

!E

#

!e print("lole")

toxic jewel
#

!e print({}.__class__().__str__().__hash__().__dir__())

night quarryBOT
#

@toxic jewel :white_check_mark: Your eval job has completed with return code 0.

['__repr__', '__hash__', '__getattribute__', '__lt__', '__le__', '__eq__', '__ne__', '__gt__', '__ge__', '__add__', '__radd__', '__sub__', '__rsub__', '__mul__', '__rmul__', '__mod__', '__rmod__', '__divmod__', '__rdivmod__', '__pow__', '__rpow__', '__neg__', '__pos__', '__abs__', '__bool__', '__invert__', '__lshift__', '__rlshift__', '__rshift__', '__rrshift__', '__and__', '__rand__', '__xor__', '__rxor__', '__or__', '__ror__', '__int__', '__float__', '__floordiv__', '__rfloordiv__', '__truediv__', '__rtruediv__', '__index__', '__new__', 'conjugate', 'bit_length', 'to_bytes', 'from_bytes', 'as_integer_ratio', '__trunc__', '__floor__', '__ceil__', '__round__', '__getnewargs__', '__format__', '__sizeof__', 'real', 'imag', 'numerator', 'denominator', '__doc__', '__str__', '__setattr__', '__delattr__', '__init__', '__reduce_ex__', '__reduce__', '__subclasshook__', '__init_subclass__', '__dir__', '__class__']
limpid slate
#

what

toxic jewel
#

!e

print({}.__class__().__str__().__hash__().__rshift__(__debug__.__int__().__hash__()))
night quarryBOT
#

@toxic jewel :white_check_mark: Your eval job has completed with return code 0.

1631837941395044143
toxic jewel
#

i love myself some random seeds

limpid slate
toxic jewel
#

long number

limpid slate
#

oh

#

what does ^ do

#

!e 2^2

toxic jewel
#

!e

[print({}.__class__().__str__().__hash__().__rshift__(__debug__.__int__().__hash__()))for(x)in(range(__debug__.__int__().__hash__()))]
night quarryBOT
#

@toxic jewel :white_check_mark: Your eval job has completed with return code 0.

310679553258299720
toxic jewel
#

huh

#

that should've caused memerror

#

!e print(__debug__.__int__().__hash__())

night quarryBOT
#

@toxic jewel :white_check_mark: Your eval job has completed with return code 0.

1
toxic jewel
#

oh

astral rover
#

^ is xor

toxic jewel
#

!e

[print({}.__class__().__str__().__hash__().__rshift__(__debug__.__int__().__hash__()))for(x)in(range(__debug__.__int__().__hash__().__rshift__(().__class__().__str__().__hash__().strip("-"))))]
night quarryBOT
#

@toxic jewel :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | AttributeError: 'int' object has no attribute 'strip'
sterile pecan
#

How to add an economy work command?

#
    users = await get_bank_data()
    ^
IndentationError: expected an indented bloc
#
# LEADERBOARD
@client.command(aliases = ["lb"])
async def leaderboard(ctx,x = 1):
users = await get_bank_data()
leaderboard = []
for user in users:
    leaderboard += (int(user), users[user]["wallet"] + users[user]["bank"])

leaderboard = sorted(leaderboard, key=lambda a: a[1])

# embed stuff here
for index, user in enumerate(leaderboard):
    em.add_field(
        name=client.get_user(int(user[0])),
        value=f"{index}: {user[1]}"
    )

    await ctx.send(embed = em)
#

How can i fix that?

astral rover
#

your in the wrong channel for that

robust aspen
#

!e

chr(__name__.__len__().__mul__(__name__.__len__().__add__(__debug__))).__add__(chr(__name__.__len__().__add__([].__str__().__len__()).__pow__([].__str__().__len__()).__add__(__debug__))).__add__(chr(__name__.__len__().__add__(__debug__).__mul__([[[]]].__str__().__len__().__lshift__(__debug__))).__mul__([].__str__().__len__())).__add__(chr(__name__.__len__().__mul__([[[]]].__str__().__len__().__add__(__name__.__len__())).__sub__(__debug__))).__add__(chr([[]].__str__().__len__().__mul__(__name__.__len__()))).__add__(chr(__name__.__len__().__mul__([[[]]].__str__().__len__().__lshift__(__debug__).__sub__(__debug__)).__sub__(__debug__))).__add__(chr(__name__.__len__().__mul__([[[]]].__str__().__len__().__add__(__name__.__len__())).__sub__(__debug__))).__add__(chr(__name__.__len__().__mul__([[[]]].__str__().__len__().__add__(__name__.__len__())).__add__([].__str__().__len__()))).__add__(chr(__name__.__len__().__add__(__debug__).__mul__([[[]]].__str__().__len__().__lshift__(__debug__)))).__add__(chr(__name__.__len__().__add__([].__str__().__len__()).__pow__([].__str__().__len__()))).__add__(chr([[]].__str__().__len__().__mul__(__name__.__len__()).__add__(__debug__)))
night quarryBOT
#

@robust aspen :warning: Your eval job has completed with return code 0.

[No output]
robust aspen
#

!e

print(chr(__name__.__len__().__mul__(__name__.__len__().__add__(__debug__))).__add__(chr(__name__.__len__().__add__([].__str__().__len__()).__pow__([].__str__().__len__()).__add__(__debug__))).__add__(chr(__name__.__len__().__add__(__debug__).__mul__([[[]]].__str__().__len__().__lshift__(__debug__))).__mul__([].__str__().__len__())).__add__(chr(__name__.__len__().__mul__([[[]]].__str__().__len__().__add__(__name__.__len__())).__sub__(__debug__))).__add__(chr([[]].__str__().__len__().__mul__(__name__.__len__()))).__add__(chr(__name__.__len__().__mul__([[[]]].__str__().__len__().__lshift__(__debug__).__sub__(__debug__)).__sub__(__debug__))).__add__(chr(__name__.__len__().__mul__([[[]]].__str__().__len__().__add__(__name__.__len__())).__sub__(__debug__))).__add__(chr(__name__.__len__().__mul__([[[]]].__str__().__len__().__add__(__name__.__len__())).__add__([].__str__().__len__()))).__add__(chr(__name__.__len__().__add__(__debug__).__mul__([[[]]].__str__().__len__().__lshift__(__debug__)))).__add__(chr(__name__.__len__().__add__([].__str__().__len__()).__pow__([].__str__().__len__()))).__add__(chr([[]].__str__().__len__().__mul__(__name__.__len__()).__add__(__debug__))))
night quarryBOT
#

@robust aspen :white_check_mark: Your eval job has completed with return code 0.

Hello World!
toxic jewel
#

adding ascii values? @robust aspen

#

editing*

robust aspen
#

yea just the shortest equations I could get for each value

#

takes about 30s to generate

toxic jewel
#

working on numbers only using dunders

#
zero  = (__doc__.__bool__().__int__())
one   = (zero.__invert__().__abs__())
two   = ({}.__class__().__str__().__len__())
three = (''.__class__.__name__.__len__())
four  = ({}.__class__.__name__.__len__())
five  = (().__class__.__name__.__len__())
#

not sure what to use for 6

#

think im gonna use complex for 7

astral rover
#

but what if i want to document my module?

#

zero and one are gonna be wrong

naive roost
#

you could do zero = {}.__len__(), or something like that

toxic jewel
robust aspen
#

for one I just use __debug__

toxic jewel
#

__debug__ can be false if you use -O

robust aspen
#

not perfect but works

#

i think the next smallest one is __name__.__len__().__bool__()

#

you could also do all even with [].__str__().__len__() with more brackets but thats a bit boring

toxic jewel
#

or

#

True

#

One of my personal favorites is (__import__("__future__").__doc__.__str__().__len__().__int__().__bool__())

#

ooh ive just came across a new 0 and 1

#

!e

_0 = (__import__("__main__").__doc__.__bool__().__int__())
_1 = (__import__("__main__").__doc__.__str__().__len__().__bool__().__int__())

print(_0, _1)
night quarryBOT
#

@toxic jewel :white_check_mark: Your eval job has completed with return code 0.

0 1
sudden willow
#

even longer strings to add into my number-inator

#

great

#

!e

print(_:=(__import__("__main__").__doc__.__str__().__len__().__bool__().__int__()).__add__(_:=(__import__("__main__").__doc__.__str__().__len__().__bool__().__int__()).__add__(_:=(__import__("__main__").__doc__.__str__().__len__().__bool__().__int__()).__add__(_:=(__import__("__main__").__doc__.__str__().__len__().__bool__().__int__()).__add__(_:=(__import__("__main__").__doc__.__str__().__len__().__bool__().__int__()).__add__(_:=(__import__("__main__").__doc__.__str__().__len__().__bool__().__int__()).__add__(_:=(__import__("__main__").__doc__.__str__().__len__().__bool__().__int__()).__add__(_:=(__import__("__main__").__doc__.__str__().__len__().__bool__().__int__()).__add__(_:=(__import__("__main__").__doc__.__str__().__len__().__bool__().__int__()).__add__(_:=(__import__("__main__").__doc__.__str__().__len__().__bool__().__int__()).__int__()))))))))))
night quarryBOT
#

@sudden willow :white_check_mark: Your eval job has completed with return code 0.

10
sudden willow
#

heres the src now

#
import sys

with open("writeoff.txt", "w") as f:
  temp=int(sys.argv[1])-2
  f.write("print(_:=(__import__(\"__main__\").__doc__.__str__().__len__().__bool__().__int__()).__add__(")

  for i in range(temp):
    f.write("_:=(__import__(\"__main__\").__doc__.__str__().__len__().__bool__().__int__()).__add__(")
  f.write("_:=(__import__(\"__main__\").__doc__.__str__().__len__().__bool__().__int__()).__int__()" + ")" * int(temp+2))
olive stag
#

hello, can someone help me figure out what the source code is ?

toxic jewel
#

lmao

tidal canyon
#

what in gods name

thin trout
#

That is honest to god programming!

hot crypt
#

is there a way to redefine True to be False using ctypes? my interpreter exits when I try to access the value

astral rover
#

yes

#

see the pins

coarse igloo
#
fib = lambda x: (__doc__.__bool__().__int__()) if x < (__doc__.__bool__().__int__().__invert__().__abs__()) else (__doc__.__bool__().__int__().__invert__().__abs__()) if x == (__doc__.__bool__().__int__().__invert__().__abs__()) else fib(x - (__doc__.__bool__().__int__().__invert__().__abs__())) + fib(x - (__doc__.__bool__().__int__().__invert__().__abs__()) - (__doc__.__bool__().__int__().__invert__().__abs__()))
#

check my fibonacci function

terse mortar
#

What's the point of inverting something just to get its absolute value?

toxic jewel
#

not sure if this is really python but heres my own esoteric lang print that was made in python

\>>|{<---><<~--<>..>>]][[]].,/'|'}msg?=()l.trollared <<.compr..meth!!!!>>< >>/<<>+.__add*(int:msg.compile,$.radd::std::cout<<'trollared';int::main;def::main::(return(fstr.//'msg.{m3th.m3th.m3th,<i.love<boys>>}',endl.=[]))*((.) <$_<<++-#<<->return()if(not)__debug__.__bool__())][;cout<<::msg?|=f&>**(*,**,func?=m41n(##>:)
terse mortar
#

!e ```py
print([1,2,3,4,5].len().abs())

print([1,2,3,4,5].len().invert().abs())

tribal moon
#

yeah

night quarryBOT
#

@terse mortar :white_check_mark: Your eval job has completed with return code 0.

001 | 5
002 | 6
terse mortar
#

What the fuck

tribal moon
#

invert 1 is -2

toxic jewel
#

!e

print((__doc__.__bool__().__int__()).__invert__().__abs__())
night quarryBOT
#

@toxic jewel :white_check_mark: Your eval job has completed with return code 0.

1
tribal moon
#

there's no point in doing __int__ on a bool

astral rover
#

thats not true

tribal moon
#

And how is that not true?

astral rover
#

0/1 is different to False/True

tribal moon
#

print((__doc__.__bool__()).__invert__().__abs__()) the code should be this

#

yes.. I know

#

I am well aware

astral rover
#

its esoteric python there is no practical use for any of this

#

the more complex it looks the better

tribal moon
#

How does __int__() make it look more complex?

astral rover
#

its more characters

tribal moon
#

that's worse

astral rover
#

thats subjective

tribal moon
#

the longer your esoteric code generator is, the worse it is imo

#

It's always the best for your esoteric code generator to generate the smallest code as possible

#

unnecessary things that add more space just make it worse

toxic jewel
#

with my esoteric code generator you feed a string in thats == 1 and it generates an equation based off of it

vagrant sleet
#

Wtf have I stumbled into

vague salmon
#

what in the world is this channel

snow beacon
#

Everything you wouldn't put in production code.

zealous widget
#

time for ultimate job security

snow beacon
#

I want an obfuscator that only changes Python's readability to about the level of C.

mortal shadow
#

you can prolly do this by using semicolons instead of linebreaks

floral meteor
#

!e ```py
time=....class.class("Now",(),{'iter':(lambda s:s),'next':(lambda s:import('time').time()),'call':(lambda s:s.next())})()
print(time())
for i in time: print(i)

night quarryBOT
#

@floral meteor :x: Your eval job timed out or ran out of memory.

001 | 1612669962.330515
002 | 1612669962.3306365
003 | 1612669962.3306687
004 | 1612669962.3306978
005 | 1612669962.3307257
006 | 1612669962.3307536
007 | 1612669962.330781
008 | 1612669962.3308082
009 | 1612669962.3308358
010 | 1612669962.3309991
011 | 1612669962.331042
... (truncated - too many lines)

Full output: too long to upload

floral meteor
#

U like?

hard spoke
#

!e

import time
def random():
    return (time.time()**2)%1.0
print(*[random() for i in range(10)])
night quarryBOT
#

@hard spoke :white_check_mark: Your eval job has completed with return code 0.

0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
floral meteor
#

Won't work... modulus will floor

#

Modulus is an integer operation

hard spoke
#

!e

import time
def random():
    return (float(time.time())**2)%1.0
print(*[random() for i in range(10)])
#

nah, I'm fairly sure it gives non-ints when float%float

floral meteor
#

Try string, then chop it in half, then the right half is pretty much random

hard spoke
#

!e

import time
def random():
    return time.time() % 1.0
print(*[random() for i in range(10)])
night quarryBOT
#

@hard spoke :white_check_mark: Your eval job has completed with return code 0.

0.873577356338501 0.8735852241516113 0.8735859394073486 0.8735864162445068 0.873586893081665 0.8735873699188232 0.8735880851745605 0.8735885620117188 0.873589038848877 0.8735895156860352
floral meteor
#

to make it float, float("0."+yay)

hard spoke
#

why does it start being zero after I square it?...

floral meteor
#

Cos integer operation

#

Probably

hard spoke
#

!e

import time
print(time.time(),time.time()**2)
print(time.time()%1,time.time()**2 % 1)
night quarryBOT
#

@hard spoke :white_check_mark: Your eval job has completed with return code 0.

001 | 1612670327.4599767 2.60070558506987e+18
002 | 0.46011853218078613 0.0
hard spoke
#

weeeird

#

must be a float problem

#

too large a number => not enough precision to reach that decimal place

#

!e

import time
def random():
    return (time.time()%100000)**2%1.0
print(*[random() for i in range(10)])
night quarryBOT
#

@hard spoke :white_check_mark: Your eval job has completed with return code 0.

0.3099184036254883 0.49164390563964844 0.6930341720581055 0.7937288284301758 0.8944234848022461 0.02868366241455078 0.09581375122070312 0.2300739288330078 0.3307685852050781 0.43146419525146484
hard spoke
#

yeah, that was it

floral meteor
#

I see a pattern. Try range 50 you'll see pattern.

#

Oh me thinks of great idea ahahaha

hard spoke
#

of course there's a pattern, it's #esoteric-python, it wasn't meant to be an actual random number generator ๐Ÿ˜›

floral meteor
#

!e ```py
class Wait:
time=import('time').time
def init(s,t=1):s._wait=t;s.now=0
def iter(s):s.now=s.time();return s
def next(s):
t=s.time();
if t<s.now+s._wait: return t-s.now
else: raise StopIteration
a=[now for now in Wait(0.1)]
print(len(a))

#

Oh r00d

#

Aha

#

Wait

#

Ouch

#

Wow

night quarryBOT
#

@floral meteor :white_check_mark: Your eval job has completed with return code 0.

168916
lavish shore
lone scarab
#

!e

l = [[[["Hello, world!",4],3],2],1]
print(l[0][0][0][0])
night quarryBOT
#

@lone scarab :white_check_mark: Your eval job has completed with return code 0.

Hello, world!
cloud fossil
#

!e

t = (((("Hello World!",),),),)
print(t[0][0][0][0])
night quarryBOT
#

@cloud fossil :white_check_mark: Your eval job has completed with return code 0.

Hello World!
cloud fossil
#

!e

t = (((("Hello World!",),),),)
print(t[False][False][False][False])
night quarryBOT
#

@cloud fossil :white_check_mark: Your eval job has completed with return code 0.

Hello World!
cloud fossil
#

!e

t = (((("Hello World!",),),),)
print(t[None][False][False][False])
night quarryBOT
#

@cloud fossil :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 2, in <module>
003 | TypeError: tuple indices must be integers or slices, not NoneType
cloud fossil
#

yo i didn't know bool is actually a subclass of int

full jewel
night quarryBOT
#

@full jewel :white_check_mark: Your eval job has completed with return code 0.

001 | 1
002 | 0
full jewel
#

Default value of False is 0 and True is 1

snow beacon
#

Not exactly a default value, they are just ones and zeros that look a little different. In a previous Python, integers were used for the (at he time unimplemented) Booleans, and it's a holdover from maintaining backwards compatibility with that.

cloud fossil
#

issubclass(bool, int) returns True

dusky dagger
#

Well yes, it says in the python docs that bool is a subclass of int

night quarryBOT
#

@umbral latch :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     print (1===1)
003 |               ^
004 | SyntaxError: invalid syntax
cedar herald
#

This isn't JavaScript ๐Ÿ˜›

terse mortar
#

I can see how you would get that confused with this channel tho

sick hound
#

๐Ÿ˜

tribal moon
#

๐Ÿคฃ

#

nice one

sick hound
#

!e 1==(_:=1)

night quarryBOT
#

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

[No output]
verbal totem
#

!e print(1==(_:=1))

night quarryBOT
#

@verbal totem :white_check_mark: Your eval job has completed with return code 0.

True
last locust
#

!e print(f"{a=}")

night quarryBOT
#

@last locust :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | NameError: name 'a' is not defined
last locust
#

!e lambda x: print(f"{x=}")(3)

night quarryBOT
#

@last locust :warning: Your eval job has completed with return code 0.

[No output]
last locust
#

!e py l = lambda x: print(x) l(3)

night quarryBOT
#

@last locust :white_check_mark: Your eval job has completed with return code 0.

3
last locust
#

!e py lambda x: print(x)(3)

night quarryBOT
#

@last locust :warning: Your eval job has completed with return code 0.

[No output]
last locust
#

!e py (lambda x: print(x))(3)

night quarryBOT
#

@last locust :white_check_mark: Your eval job has completed with return code 0.

3
last locust
#

!e py (lambda x: print(f"{x=}"))(3)

night quarryBOT
#

@last locust :white_check_mark: Your eval job has completed with return code 0.

x=3
terse mortar
#

ok so why does ```py
print([].len().bool().str().len().add([1].len().bool().str().len()).str().add([].len().bool().str().len().add([1].len().bool().str().len()).str()).int())

```py
print(int([].__len__().__bool__().__str__().__len__().__add__([1].__len__().__bool__().__str__().__len__()).__str__().__add__([].__len__().__bool__().__str__().__len__().__add__([1].__len__().__bool__().__str__().__len__()).__str__())))
earnest wing
#

int(str) does not call str.__int__(), the parsing is in the int constructor

broken mesa
floral meteor
#

ik its very broken

low apex
#

!e import antigravity

night quarryBOT
#

@low apex :warning: Your eval job has completed with return code 0.

[No output]
low apex
#

of course

sick hound
#

kids learn ur times table

cedar herald
#

This isn't what this channel is for

fluid prawn
#

!e

print(....__class__().__str__()[__debug__.__bool__().__str__().__len__().__int__().__sub__(__debug__.__bool__().__str__().__len__().__int__())])
night quarryBOT
#

@fluid prawn :white_check_mark: Your eval job has completed with return code 0.

E
thin trout
#

Hey, I can actually follow this snippet haha

elfin onyx
#

i can't

#

๐Ÿ˜ฆ

cloud fossil
#

i can

#
print(str(type(...)())[ len(str(bool(__debug__))) - len(str(bool(__debug__))) ])
#
print(str(Ellipsis)[len(str(True))-len(str(True))])
print("Ellipsis"[len("True")-len("True")])
print("Ellipsis"[4-4])
print("Ellipsis"[0])
print("E")
terse mortar
#

That's similar to this ```py
print(().class.name.str()[::-(().class.name.str().len().sub([1].len().bool().str().len()).sub(().class.name.str().len().sub(().class.name.str().len().sub([1].len().bool().str().len()).sub(().class.name.str().len().sub([1].len().bool().str().len()).sub(().class.name.str().len().sub([1].len().bool().str().len()).sub(().class.name.str().len().sub([1].len().bool().str().len()).sub(().class.name.str().len().sub([1].len().bool().str().len()).sub(().class.name.str().len().sub([1].len().bool().str().len()).sub(().class.name.str().len().sub([1].len().bool().str().len()))))))))))])

cloud fossil
#

maybe

#

!e print(().class.name.str()[::-(().class.name.str().len().sub([1].len().bool().str().len()).sub(().class.name.str().len().sub(().class.name.str().len().sub([1].len().bool().str().len()).sub(().class.name.str().len().sub([1].len().bool().str().len()).sub(().class.name.str().len().sub([1].len().bool().str().len()).sub(().class.name.str().len().sub([1].len().bool().str().len()).sub(().class.name.str().len().sub([1].len().bool().str().len()).sub(().class.name.str().len().sub([1].len().bool().str().len()).sub(().class.name.str().len().sub([1].len().bool().str().len()))))))))))])

night quarryBOT
#

@cloud fossil :white_check_mark: Your eval job has completed with return code 0.

tl
dapper parrot
terse mortar
#

after a few hours, ive finally finished it. 10k char hello world program!
onliner: https://gist.github.com/ChiliMX/cc81819f8ffc13387d8d2dc9cebdaef0
pycharm reformat: https://gist.github.com/ChiliMX/821bf6db53a5b6104bfcb516e2c5bd83

Gist

a nice, one liner hello world project. GitHub Gist: instantly share code, notes, and snippets.

Gist

Pycharm code reformat made my amazing oneliner(check out my other gist) into this - no longer a one liner.py

naive roost
#

wow

terse mortar
#

lol

#

i can make it worse, but im in class rn. I will later tho.

naive roost
#

what's next? 100k?

terse mortar
#

well, replaceing sqrt into dunders in that program

#

i did it with math so its def possible.

naive roost
#

well, x**.5 is close (but not equal in all circumstances) to sqrt(x)

#

so x.__pow__((1).__truediv__(2)) could work (however you define 1 and 2)

terse mortar
#

Yeah ik. I mean like writing out the letters sqrt just in dunders

thin trout
#

If it is a Decimal object, then it will be the same

naive roost
#

yeah, that's why floating point maths is annoying

terse mortar
#

I think y'all are misunderstanding me. I'm going to make the word sqrt using chr and Dunders

naive roost
#

oh, right

thin trout
#

Haha nice

terse mortar
#

That's what I did with the word math(variable ______ in this case), and it works AND it adds like 1k chars

night quarryBOT
#

Hey @terse mortar!

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

terse mortar
#

I did not mean to do that.

terse mortar
#

Ty ty

#

My goal is to one day make something cursed enough to get a pin

sudden willow
#

reminds me of my hello world statement

#

editing ascii values i assume?

#

i love how wavy it is

terse mortar
sudden willow
#

ah very cool

terse mortar
#

ty ty

sudden willow
cloud fossil
#

i merely translated the dunder methods to built-in functions

sudden willow
#

imma lengthen my hello world statement brb

terse mortar
sudden willow
#

_uwu*

#

i cant use _ because it would overwrite the main function

terse mortar
#

keep stacking the underscores lol

#

ok lets make sqrt with just dunders

sudden willow
#

"assignment expression cant be used in list comprehension"

#

life ruined

#

so glad i have a program to make these long strings

#

nooooooooooooooooooooooo

terse mortar
#

Lol

#

I need to make a code gore generator

tribal moon
#

make your own esoteric language using Python

terse mortar
#

LMFAOOOO MY COMPSCI TEACHER DOESNT THINK ITS REAL PYTHON LOL

terse mortar
tribal moon
#

there's a lot of tutorials online

#

I think how it goes is you have to build a lexer and then make your own syntax

#

here's an idea: make a programming language with only words

#

as in py print("Hello, World!") would be print OPENING_BRACKET DOUBLE_QUOTE UPPER_LETTER H LETTER E LETTER L LETTER L LETTER O COMMA UPPER_LETTER W LETTER O LETTER R LETTER L LETTER D DOUBLE_QUOTE CLOSING_BRACKET

#

something like that lol

terse mortar
#

Lol I mean I'm sure it's possible

#

Just like use ascii chars, since they are in uppercase, right?

tribal moon
#

I think it'd require regex

#

I really wanna make my own little fun language with python

terse mortar
tribal moon
#

it's just an idea for now

#

just for fun

toxic jewel
#

heres a fun way i found to print 66

#

!e

print((....__class__().__str__().__hash__().__abs__().as_integer_ratio.__str__().__len__()))
night quarryBOT
#

@toxic jewel :white_check_mark: Your eval job has completed with return code 0.

66
toxic jewel
terse mortar
tribal moon
#

it has to have the $ dollar sign in front of it to be highlighted

floral meteor
#
$ahahahaha$%ahahahhaha
what even is tex?
#

is it like latex?

twilit grotto
#

yes

snow beacon
#

LaTeX is TeX plus some extra macros.

naive roost
#

A lot of convenience macros

summer tulip
#

!e

print(int(str((1 << (1 << (1 << 1))) * ((11 << 1) + 1)), 1 << (1 << (1 << 1))))

A shortest expression I can do that getting 872 only using the digit 1.

night quarryBOT
#

@summer tulip :white_check_mark: Your eval job has completed with return code 0.

872
summer tulip
#

!e

print((((((((True << (((True << True) + True))) - True) << (True << True))) - True) << (True << True)) + True) << ((True << True) + True))

This time without integer literals and multiplication which is more computing-expensive than bit-shifts.

night quarryBOT
#

@summer tulip :white_check_mark: Your eval job has completed with return code 0.

872
summer tulip
#

!e

import timeit
print(timeit.timeit('(((((((True << (((True << True) + True))) - True) << (True << True))) - True) << (True << True)) + True) << ((True << True) + True)', number=5000000))
print(timeit.timeit('872', number=5000000))

Apparently the esoteric expression is sometimes faster than the literal. ๐Ÿ™‚

night quarryBOT
#

@summer tulip :white_check_mark: Your eval job has completed with return code 0.

001 | 0.058903101831674576
002 | 0.0643576211296022
sick hound
#

!e
import timeit
print(timeit.timeit('(((((((True << (((True << True) + True))) - True) << (True << True))) - True) << (True << True)) + True) << ((True << True) + True)', number=5000000))
print(timeit.timeit('872', number=5000000))

night quarryBOT
#

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

001 | 0.08057978143915534
002 | 0.06087453104555607
sick hound
#

!e
import timeit
print(timeit.timeit('(((((((True << (((True << True) + True))) - True) << (True << True))) - True) << (True << True)) + True) << ((True << True) + True)', number=50000000))
print(timeit.timeit('872', number=50000000))

night quarryBOT
#

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

001 | 0.6325192009098828
002 | 0.7232883931137621
sick hound
#

goes back and forth

#

@summer tulip

#

ยฏ_(ใƒ„)_/ยฏ

twilit grotto
#

pretty sure that's just a measurement error

#

each operation would take nanoseconds on its own

sick hound
#
$highlight be cool$
stark fable
#

!e py import dis dis.dis('(((((((True << (((True << True) + True))) - True) << (True << True))) - True) << (True << True)) + True) << ((True << True) + True)')

night quarryBOT
#

@stark fable :white_check_mark: Your eval job has completed with return code 0.

001 |   1           0 LOAD_CONST               0 (872)
002 |               2 RETURN_VALUE
stark fable
twilit grotto
#

lmfao