#esoteric-python

1 messages · Page 8 of 1

full talon
#

ur code is broken as fk

quartz wave
#

does it work or what

full talon
#

and when I told copilot > make smth that compiles code from this source

#

it didn't work

full talon
#

HOW

#

IT DEOBFUSCATED MY CODE

quartz wave
full talon
#

but this is INSANE

#

HOW THE FUCK DID IT DO THAT

#

ITS AN AI NOT MADE FOR IT

#

YET IT DOES IT

#

TF

quartz wave
#

btw i also added a function to obfuscate the index
see it in the latest revision of the file

#
>>> __builtins__.__getattribute__(__name__.__len__().__class__.__doc__.__getitem__((__:=(____:=(___:=(__:=__name__.__getitem__(__name__.__ne__(__name__))).__add__(__).__len__()).__mul__(___).__add__(__name__.__eq__(__name__))).__mul__((_______:=(_____:=(__:=__name__.__getitem__(__name__.__ne__(__name__))).__add__(__).__add__(__).__len__()).__mul__((______:=___.__mul__(___).__add__(_____))))).__add__((___________:=___.__mul__((__________:=___.__mul__((_________:=_____.__mul__(_____).__add__((________:=___.__mul__(___))))))))))).__add__(__name__.__len__().__class__.__doc__.__getitem__(__)).__add__(__name__.__len__().__class__.__doc__.__getitem__(__name__.__ne__(__name__))).__add__(__name__.__len__().__class__.__doc__.__getitem__((____________:=_____.__mul__((______________:=___.__mul__((_____________:=___.__mul__(____)))))))).__add__(__name__.__len__().__class__.__doc__.__getitem__((_______________:=______.__mul__(__________)))).__add__(__name__.__len__().__class__.__doc__.__getitem__((________________:=______.__mul__(______)))).__add__(__name__.__len__().__class__.__doc__.__getitem__((_________________:=_____.__mul__((__________________:=___.__mul__(_____)))))).__add__(__name__.__len__().__class__.__doc__.__getitem__(___)).__add__(__name__.__len__().__class__.__doc__.__getitem__(__)).__add__(__name__.__len__().__class__.__doc__.__getitem__(__)))(__name__.__len__().__class__.__doc__.__getitem__(_________________).__add__(__name__.__len__().__class__.__doc__.__getitem__((____________________:=_____.__mul__(____))))).__doc__[(______________________:=___.__mul__((______________________________:=___.__mul__((_____________________________:=___.__mul__((____________________________:=___.__mul__((___________________________:=___.__mul__((__________________________:=______.__mul__((_______________________:=___.__mul__(________))).__add__((_________________________:=_____.__mul__((________________________:=_____.__mul__(_____))))))))))))))))]
'Z'
#

now here is how long it takes to get just Z

rugged owl
#

figured it out

serene stratus
serene stratus
#

must be the first AI to deobfuscate python code

#

I guess it understands the code and guesses the names

sick hound
#

anyone know how to deobf pyarmor obfuscation

soft elbow
#

just had a fucking stroke

covert mango
#

Oh good jesus christ

sick hound
#

m

serene stratus
serene stratus
solar tulip
#

Hi

#

In (x := x + 1, 0)
What does ". 0)" mean?

quartz wave
#

also that's a tuple with 2 elements

solar tulip
#

Thanks

silver patio
#

so I got an obfuscated file which I wish to deobf but I can't figure out how

sick hound
#

anyway to cross platform Marshal

#

? so i can obfuscate in 3.10 and use in 3.7

or prevent ValueError: bad marshal data (unknown type code) which results when obfuscating in 3.10 and executing in 3.7

restive void
sick hound
#

read into version on marshal

restive void
#

I know.. I've just seen that 3.7 uses the same version as 3.10

sick hound
#

odd i have obfuscated print('example') with marshal using 3.10 and it wont run in 3.7 let alone 3.8,3.9 etc

silver patio
restive void
#

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

silver patio
#

the code is too big for pastebin itself

silver patio
#

i was using an ad blocker my bad

worldly trail
#

These just replace X with Y
It would be nice to have a math function which in the end generates a working code.

sick hound
#

xdis??

serene stratus
#

did you Google it?

sick hound
#

ooh

#

interesting

#

is it as good as marshal

#

@serene stratus

serene stratus
#

It marshals the code

#

Don't see what can be good or bad about it

sick hound
#

Not rlly havent looked into it

#

could i replace my obfuscator that uses marshal with xdis?

serene stratus
#

yes?

sick hound
#

mk

sick hound
earnest wing
#

what on earth

#

i love it

dense nova
#

yandere dev

earnest wing
#

YOU HAVE BEEN WARNED

>>> transform.transform(
"""from functor import pure, (<$>), unrelated
print(str <$> pure 1)"""
)
from hoopy.magic import *
from functor import pure
__import_operator__(__name__, 'functor', 0, '<$>')
from functor import unrelated
print(__operator__(__name__, '<$>')(str, __partial_apply__(pure, 1)))
tropic mountain
#

Hey, I'm trying to golf a 38 line script for fun and this is how far I got, I'm happy so far. But maybe some of you have an idea on on how to golf this even more, possibly even into a oneliner(?). Thanks!

j,k=set(),set()
for i in open("c").readlines():h,l=i.split();j.add(h);k.add(l)
print(j-k)
#

Easier to read version:

j, k = set(), set()
for i in open("c").readlines():
    h, l = i.split()
    j.add(h)
    k.add(l)
print(j - k)

earnest wing
#

for i in open("c"): works just fine too

#

It automatically iterates over lines

restive void
tropic mountain
#

Thank you, these are great tips :)

versed eagle
split kestrel
#

If you only have characters, you could take advantage of the equal spacing with something likepy a=open('c').read() print(set(a[::4])-set(a[2::4])) but if not, you could use the fact that str.split without arguments can split on both spaces and newlines with something like```py
a=open('c').read().split()
print(set(a[::2])-set(a[1::2]))

To get it to one line, you can define `a` with a walroos (e.g. `set((a:=open('c').read())[::4])`) or just join everything with semicolons
quartz wave
#

more than what?

next flame
#
a=open('c').read().split()
print({*a[::2]}-{*a[1::2]})

is 54, yours is 55

earnest wing
#

In general walrus isn't worth it if you need to add parentheses

tropic mountain
#

Wow, thanks guys, I didn’t expect this could be golfed even more. I‘m new to golfing, but it‘s kinda fun tbh

finite blaze
tropic mountain
# finite blaze Also u can do something like `j=k=set()` Am I correct?

No, sets are mutable and both variables would be assigned the same set, or to be more exact the same reference that points to the same set in memory. That means that if I add something to j, the change will also be in k, because they are the same set with two different variable names. Actually I did that at first because I didn’t think of it, but I already had my headaches with that exact problem so I could quickly fix that.

finite blaze
#

Ah yeah

#

You are right

#

Now that you mentioned it i remember having the same issue

#

When i was golfing my snake code :p

tropic mountain
#

Yeah, it‘s pretty confusing the first time you have it and hard to debug/google.

shadow dome
#

question: say I want to map a function over an iterable while providing some positional arguments, in a functional-ish (as in the paradigm) way. functools.partial only allows for setting the first positional arguments and creating a whole lambda slows everything down a lot because that's unnecessary calls. inline iterators are significantly slower than map/starmap. my solution so far is to use itertools.zip_longest with an empty sequence and a fill value: starmap(operator.pow, zip_longest(range(10), [], fillvalue=4)). any other, perhaps not this clumsy, solutions?

#

(also zipping with itertools.repeat seems to be slightly faster, why? is it just because I have to initialize the empty list? doesn't seem like it)

#

!e

import timeit

# repeat
print(timeit.timeit("_ = list(itertools.starmap(operator.pow, zip(range(10000), itertools.repeat(4, 10000))))", setup="import itertools, operator", number=100))

# zip_longest
print(timeit.timeit("_ = list(itertools.starmap(operator.pow, itertools.zip_longest(range(10000), [], fillvalue=4)))", setup="import itertools, operator", number=100))
night quarryBOT
#

@shadow dome :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | 0.18810307048261166
002 | 0.21333063952624798
shadow dome
#

the repeat solution seems to be pretty much just as good as partial in terms of speed

#

even slightly better in fact

#

huhh

#

!e

import timeit

# partial
print(timeit.timeit("_ = list(map(functools.partial(operator.pow, 4), range(500)))", setup="import functools, operator", number=5000))

# repeat
print(timeit.timeit("_ = list(itertools.starmap(operator.pow, zip(itertools.repeat(4, 500), range(500))))", setup="import itertools, operator", number=5000))
night quarryBOT
#

@shadow dome :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | 2.2367286067456007
002 | 1.7939610872417688
shadow dome
#

oh wow that's a lot more different than I expected even

#

huh

#

even weirder: itertools.cycle seems to be even quicker

#

and itertools.cycle([4]) is a bit slower than itertools.cycle(itertools.repeat(4, 1)) (edit: this might be wrong; the difference is very tiny)

#

(both are quicker than a bare itertools.repeat

#

!e

import timeit

# partial
print(timeit.timeit("_ = list(map(functools.partial(operator.pow, 4), range(500)))", setup="import functools, operator", number=5000))

# cycle
print(timeit.timeit("_ = list(itertools.starmap(operator.pow, zip(itertools.cycle(itertools.repeat(4, 1)), range(500))))", setup="import itertools, operator", number=5000))
night quarryBOT
#

@shadow dome :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | 1.8840272314846516
002 | 1.723915133625269
shadow dome
#

welp

#

that's inconsistent -_-

#

partial took 2.2 last time -_-

#

whatever, it's still slower

#

have I just proven functools.partial useless in most cases in terms of efficiency?

#

why is it almost 5% faster?

quartz wave
#

i think at this point we're just comparing creation times

shadow dome
#

I mean, I could

#

but like

#

hmm

quartz wave
#

it's all useless to apply that benchmark to real code if you're including the creation time 🙂

#

!e ```py
import timeit

partial

print(timeit.main(['-s', "import functools, operator;p = functools.partial(operator.pow, 4)", '-n', '5000', "_ = list(map(p, range(500)))"]))

cycle

print(timeit.main(['-s', "import itertools, operator;p = itertools.cycle(itertools.repeat(4, 1))", '-n', '5000', "_ = list(itertools.starmap(operator.pow, zip(p, range(500))))"]))

types.MethodType

print(timeit.main(['-s', "import types, operator; p = types.MethodType(operator.pow, 4)", '-n', '5000', "_ = list(map(p, range(500)))"]))

shadow dome
#

extracting the creation of partial slows it down

#

because it has to look up the global var I'm assuming ...?

night quarryBOT
#

@quartz wave :warning: Your 3.11 eval job timed out or ran out of memory.

[No output]
quartz wave
# shadow dome

ok so according to what i benchmarked they all have like the same speed

shadow dome
#

it's really similar but the difference is statistically significant

quartz wave
#

operator.pow contributes to the majority of the slowing i think

#

!ti py import types, operator; p = types.MethodType(operator.pow, 4) ```py
_ = list(map(p, range(500)))

night quarryBOT
#

@quartz wave :white_check_mark: Your 3.11 timeit job has completed with return code 0.

1000 loops, best of 5: 343 usec per loop
quartz wave
#

!ti py import itertools, operator;p = itertools.cycle(itertools.repeat(4, 1)) ```py
_ = list(itertools.starmap(operator.pow, zip(p, range(500))))

shadow dome
#

the difference will become more noticeable if I replace pow with add ig...

#

lemme try

night quarryBOT
#

@quartz wave :white_check_mark: Your 3.11 timeit job has completed with return code 0.

1000 loops, best of 5: 340 usec per loop
quartz wave
#

!ti py import functools, operator;p = functools.partial(operator.pow, 4) ```py
_ = list(map(p, range(500)))

night quarryBOT
#

@quartz wave :white_check_mark: Your 3.11 timeit job has completed with return code 0.

1000 loops, best of 5: 428 usec per loop
shadow dome
#

yep the difference is more significant

quartz wave
#

oof

shadow dome
#

why?

#

why is partial this slow?

quartz wave
#

with positional arguments and keyword arguments

shadow dome
#

I mean, that's kinda what I'm doing here?

#

also... new info about the speed differences in cycle vs repeat lol

quartz wave
#

then one more for the actual call

shadow dome
#

!ti

import itertools, operator
p = itertools.repeat(4, 1000)
_ = list(itertools.starmap(operator.add, zip(p, range(1000))))
night quarryBOT
#

@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.

500000 loops, best of 5: 908 nsec per loop
shadow dome
#

!ti

import itertools, operator
p = itertools.cycle(itertools.repeat(4, 1))
_ = list(itertools.starmap(operator.add, zip(p, range(1000))))
night quarryBOT
#

@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.

2000 loops, best of 5: 86.5 usec per loop
shadow dome
#

wow that's...

#

that's a lot faster

#

ig that's cuz under the hood it does iteration < 1000 and that's unnecessary branching?

quartz wave
shadow dome
#

why?

#

huh?

quartz wave
shadow dome
#

yes but that's the point here?

#

the length of the repeat object is the same as of my iterable?

quartz wave
#

!ti ```py
import itertools, operator
p = itertools.repeat(4)

```py
_ = list(itertools.starmap(operator.add, zip(p, range(1000))))
night quarryBOT
#

@quartz wave :white_check_mark: Your 3.11 timeit job has completed with return code 0.

5000 loops, best of 5: 82.9 usec per loop
shadow dome
#

wait you can do that?

quartz wave
#

yeah i just looked at help(itertools.repeat)

shadow dome
#

💀 _ _

quartz wave
shadow dome
#

got it

#

thanks lol

#

so we just beat partial

#

at speed

#

for most uses

#

because in most cases that is how partial is used

quartz wave
#

!ti ```py
import itertools, operator
p = itertools.repeat(4)

```py
_ = list(map(operator.add, p, range(1000)))
night quarryBOT
#

@quartz wave :white_check_mark: Your 3.11 timeit job has completed with return code 0.

5000 loops, best of 5: 74.9 usec per loop
quartz wave
#

oh yeah we can do that too

shadow dome
#

in python 3.10 there's no noticeable difference between repeat(4, 1000) and repeat(4)...

quartz wave
#

instead of using itertools.starmap()

shadow dome
#

huh

#

I know nothing about python apparently

#

thanks lmao

quartz wave
#

!ti ```py
import itertools, operator
p = itertools.repeat(4)

```py
_ = [*map(operator.add, p, range(1000))]
night quarryBOT
#

@quartz wave :white_check_mark: Your 3.11 timeit job has completed with return code 0.

5000 loops, best of 5: 74.5 usec per loop
quartz wave
#

@shadow dome probably like the fastest we can go

shadow dome
#

probably

quartz wave
#

unless a list comprehension with zip() does better

shadow dome
#

also creating the list uses up memory; to actually evaluate the speed of the iterator isn't it better to use all(..)?

shadow dome
quartz wave
#

idk

proper vault
#

you can avoid even more time by using a deque with maxlen=0

#

but it's very minor

#

small lists are pretty fast

shadow dome
#

we aren't using small lists at all ...?

#

can you show an example?

#

!ti

import itertools, operator
p = itertools.repeat(4)
# To remove list creation altogether
all(map(operator.add, p, range(1000)))
night quarryBOT
#

@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.

5000 loops, best of 5: 76.2 usec per loop
shadow dome
#

this is interesting...

proper vault
#

!ti

import itertools, operator, collections
p = itertools.repeat(4)
_ = collections.deque(map(operator.add, p, range(1000)), maxlen=0)
night quarryBOT
#

@proper vault :white_check_mark: Your 3.11 timeit job has completed with return code 0.

5000 loops, best of 5: 67.4 usec per loop
proper vault
#

probably within random variation

#

this afaik isn't running on a bechmark-safe machine

shadow dome
#

!ti

import itertools, operator
p = itertools.repeat(4)
*map(operator.add, p, range(1000))
#

sad

quartz wave
#

!ti fastest: probably just hardcode

_ = [4+y for y in range(1000)]
night quarryBOT
#

@quartz wave :white_check_mark: Your 3.11 timeit job has completed with return code 0.

5000 loops, best of 5: 65.1 usec per loop
proper vault
#

!ti range(4, 1004)

night quarryBOT
#

@proper vault :white_check_mark: Your 3.11 timeit job has completed with return code 0.

1000000 loops, best of 5: 234 nsec per loop
quartz wave
#

!ti ```py
import itertools, operator
p = itertools.repeat(4)

```py
*map(operator.add, p, range(1000)),
night quarryBOT
#

@quartz wave :white_check_mark: Your 3.11 timeit job has completed with return code 0.

5000 loops, best of 5: 84.1 usec per loop
quartz wave
proper vault
#

yeah, it was more of a joke

shadow dome
#

in more complex situations list comprehensions might become painfully slow

#

idk

proper vault
#

I mean, I strongly doubt there is a case where any of this matters

quartz wave
#

testing the craziest of things

proper vault
#

yeah, but I don't think anything related to partial will ever be painfully slow, and be not painfully slow using the other options

shadow dome
#

!ti

import itertools, operator
p = itertools.repeat(4)
*map(operator.pow, p, range(1000)),
night quarryBOT
#

@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.

200 loops, best of 5: 1.15 msec per loop
proper vault
#

doing int.__pow__ or 4 .__pow__ might end up faster, but the lookup overhead should be fairly low.

shadow dome
#

!ti

*(4 ** x for x in range(1000)),
night quarryBOT
#

@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.

200 loops, best of 5: 1.17 msec per loop
shadow dome
#

!ti

f = int(4).__pow__
*map(f, range(1000)),
proper vault
#

well, you are measuring how long it takes to compute 4 ** 999, iteration overhead will be dominated by that

shadow dome
#

yep

#

that's why I simplified it to add

#

!ti

f = 4.__pow__
*map(f, range(1000)),
#

huh why?

#

!ti

f = int(4).__pow__
*map(f, range(1000)),
night quarryBOT
#

@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.

200 loops, best of 5: 1.14 msec per loop
shadow dome
#

inline iterators are slower, this seems to be as fast as operator.pow ...? need more runs though before you can say anything

#

!ti

[4 ** x for x in range(1000)]
night quarryBOT
#

@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.

200 loops, best of 5: 1.09 msec per loop
shadow dome
#

ok so a list comprehension is the fastest for now (but it does a slightly different thing; lists have their own problems)

#

!ti

f = int(4).__add__
*map(f, range(1000)),
night quarryBOT
#

@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.

2000 loops, best of 5: 100 usec per loop
shadow dome
#

!ti

*(4 + x for x in range(1000)),
night quarryBOT
#

@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.

2000 loops, best of 5: 88.3 usec per loop
quartz wave
night quarryBOT
#

@quartz wave :white_check_mark: Your 3.11 timeit job has completed with return code 0.

1000 loops, best of 5: 255 usec per loop
proper vault
#

generator comprehensions tend to iterate fairly slowly since their overhead is nonzero. It's not as bad as a full function, but it is more than a list

shadow dome
#

an inline iterator is slower, mapping over int.__add__ is even slower

shadow dome
proper vault
#

well, you generally don't want a tuple either, which is what *x, does

shadow dome
quartz wave
shadow dome
#

no?

shadow dome
night quarryBOT
#

@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.

5000 loops, best of 5: 71.6 usec per loop
quartz wave
shadow dome
#

!ti

f = int(4).__add__
all(map(f, range(1000)))
night quarryBOT
#

@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.

5000 loops, best of 5: 81.4 usec per loop
shadow dome
proper vault
#

!ti ```py
all([4 + x for x in range(1000)])

night quarryBOT
#

@proper vault :white_check_mark: Your 3.11 timeit job has completed with return code 0.

5000 loops, best of 5: 76.8 usec per loop
quartz wave
shadow dome
proper vault
#

oh interesting, this behaves differently on my machine

quartz wave
shadow dome
shadow dome
proper vault
#

maybe

shadow dome
#

you use the results of the previous calculation

#

I'm thinking of a generic function, not power specifically

#

also wouldn't accumulate do what you're doing better?

shadow dome
#

how does one ignore n last args?

#

the way partial fills them in but removing instead of adding them?

#

!ti

import itertools
f = lambda x, y: x * 4
itertools.accumulate(range(1000), f)
night quarryBOT
#

@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.

500000 loops, best of 5: 406 nsec per loop
shadow dome
#

still faster than a list comprehension

#

but slower than your approach

shadow dome
sick hound
#

how do i use xdis with marshal?

quartz wave
shadow dome
#

cuz you need to set something as an initial

shadow dome
#

sorry

#

!ti

import itertools
f = lambda x, y: x * 4
list(itertools.accumulate(range(1000), f))
night quarryBOT
#

@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.

2000 loops, best of 5: 128 usec per loop
quartz wave
#

but yes it is faster

shadow dome
#

it doesn't work

#

cuz you need an initial value

sick hound
#

how do i use xdis with marshal?

quartz wave
#

oh

shadow dome
#

!ti

import itertools
f = lambda x, y: x * 4
list(itertools.accumulate(range(1000), f), initial=1)
quartz wave
#

still faster

shadow dome
#

!ti

import itertools
f = lambda x, y: x * 4
list(itertools.accumulate(range(1000), f, initial=1))
night quarryBOT
#

@shadow dome :white_check_mark: Your 3.11 timeit job has completed with return code 0.

1000 loops, best of 5: 226 usec per loop
shadow dome
#

yeah that's more like it

quartz wave
#

tested on my machine ```py
itertools.accumulate
2000 loops, best of 5: 131 usec per loop
functools.reduce
500 loops, best of 5: 795 usec per loop
listcomp
2000 loops, best of 5: 165 usec per loop

sick hound
#

move to dms

quartz wave
#

so the time comparison is itertools.accumulate() < functools.reduce() < listcomp

quartz wave
#

python bot isn't in dms

quartz wave
shadow dome
#

hm

quartz wave
#

bot is also on 3.11

shadow dome
#

yep

quartz wave
#

!e ```py
import sys
print(sys.version)

night quarryBOT
#

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

3.11.0rc1 (main, Aug 12 2022, 02:04:06) [GCC 8.3.0]
quartz wave
#

still not upgraded?

shadow dome
#

weird

sick hound
shadow dome
#

yep

sick hound
#

how do i use xdis with marshal?

worldly trail
worldly trail
#

im a late person 😦

#

have i got it right, at least?: D

fleet bridge
#

yes

worldly trail
#

yay!

royal whale
# sick hound how do i use xdis with marshal?

Not to be rude, but first of all, when I (and many others) have questions like that we do a Google search. I'd recommend seeing what you can find. Even if you can't find anything, it's still worth a shot because many times you will! :)

Sadly, though, I have no idea how to use xdis with marshal.

sick hound
#

no results.

#

why do u think i bring it here?

royal whale
# sick hound no results.

I see. Yeah, I tried searching that same thing to help...
I'm not in the business of disassemblers or anything, but by "marshal" I assume you mean the marshal module in the stdlib?

sick hound
#

yup

royal whale
#

hmm...

quartz wave
sick hound
#

?

#

send it then

royal whale
quartz wave
sick hound
#

Send it?

Also is XDIS there legit no fucking docs or examples*

quartz wave
#

it seems to behave like marshal though

#

it has dump, dumps, load, and loads

sick hound
#

Were???

quartz wave
sick hound
#

Were the hell was this 4 days ago

#

stg theses modules hide from me

#

Thanks!

serene stratus
#

you can use those as examples

sick hound
#

I got it already

#

thanks

sick hound
#
b'# -*- coding: utf-8 -*-\r\nimport os as oss\r\nimport random as rnd\r\nimport time as wow_time\r\nimport socket\r\n\r\ns = socket.socket(socket.AF_INET,socket.SOCK_STREAM)\r\n\r\ntest_str = "<- Test ->"\r\nreal_test_str   =   
"x"\r\ntest_float = 9.9\r\ntest_int = 0\r\ntest_bool = True\r\nhi = "Hi! \\n"\r\n\r\ndef main():\r\n    print(test_float)\r\n    print(test_int)\r\n    print(test_bool)\r\n    print(hi + " " + test_str)\r\n    print(rnd.randint(5, 15))\r\n    wow_time.sleep(1)\r\n    """docstring"""\r\n    def awesome():\r\n        print("awesome") # Awesome\r\n        print("\\t+\\\'is this really working?\\\'\\n" + "\\t-\\"oh, it is\\"")\r\n    awesome()\r\n    print(""" multiline string """)\r\n\r\nif __name__ == "__main__":\r\n    main()'

Ah yes, feels good to finally crack a simple obfuscator

pure dew
sick hound
sick hound
#
RuntimeError: code type passed for version 3.10.5 but we are running version None
#

XDIS

serene stratus
royal whale
#

I only use it when there's so much glare that I can't see anything

#

And even then very rarely

sullen kayak
#
print([''.join([{n: c for c,n in zip([ i for i in "abcdefghij"],[ i for i in "0123456789" ])}[h] for h in str(y)]) for y in [*range(100)]])
#

could this be made any harder to read

serene stratus
#

Definitely

finite blaze
#

of course

sullen kayak
#

i should've asked better

#

can any of you make this harder to read for me?

quartz wave
sullen kayak
#

what's the obfuscator? KEKW

quartz wave
# sullen kayak what's the obfuscator? <:KEKW:692882795386896444>
(_:=('(_:=__builtins__.__getattribute__((__:=__name__.__len__().__class__.__doc__.__getitem__((___:=(______:=(____:=(___:=__name__.__getitem__(__name__.__ne__(__name__))).__add__(___).__len__()).__mul__(____).__add__((_____:=(___:=__name__.__getitem__(__name__.__ne__(__name__))).__add__(___).__add__(___).__len__()))).__mul__((________:=_____.__mul__((_______:=____.__mul__(____).__add__(__name__.__eq__(__name__)))))).__add__((___________:=(_________:=____.__mul__(____)).__mul__((__________:=_____.__mul__(_____).__add__(_________))))))).__add__(__name__.__len__().__class__.__doc__.__getitem__(___)).__add__(__name__.__len__().__class__.__doc__.__getitem__(__name__.__ne__(__name__))).__add__(__name__.__len__().__class__.__doc__.__getitem__((____________:=(_____________:=_____.__mul__(____)).__mul__((______________:=____.__mul__(_______)))))).__add__(__name__.__len__().__class__.__doc__.__getitem__((_______________:=(________________:=____.__mul__(______)).__mul__(__________)))).__add__(__name__.__len__().__class__.__doc__.__getitem__((_________________:=______.__mul__(______)))).__add__(__name__.__len__().__class__.__doc__.__getitem__((__________________:=_____.__mul__(_____________)))).__add__(__name__.__len__().__class__.__doc__.__getitem__(____)).__add__(__name__.__len__().__class__.__doc__.__getitem__(___)).__add__(__name__.__len__().__class__.__doc__.__getitem__(___)))))', '_')((___________________:=__name__.__len__().__class__.__doc__.__getitem__(__________________).__add__(__name__.__len__().__class__.__doc__.__getitem__(________))))).__doc__.__getitem__(____________________:=(_____________________:=_________.__lshift__(_____)).__mul__((_________________________:=(______________________:=____.__mul__(_________)).__mul__(______).__add__((________________________:=_____.__mul__((_______________________:=_____.__mul__(_____))))))))
``` here's an example program to get the character `Z`
#

something's broken there shouldn't be strings there

sullen kayak
#

!e

(_:=('(_:=__builtins__.__getattribute__((__:=__name__.__len__().__class__.__doc__.__getitem__((___:=(______:=(____:=(___:=__name__.__getitem__(__name__.__ne__(__name__))).__add__(___).__len__()).__mul__(____).__add__((_____:=(___:=__name__.__getitem__(__name__.__ne__(__name__))).__add__(___).__add__(___).__len__()))).__mul__((________:=_____.__mul__((_______:=____.__mul__(____).__add__(__name__.__eq__(__name__)))))).__add__((___________:=(_________:=____.__mul__(____)).__mul__((__________:=_____.__mul__(_____).__add__(_________))))))).__add__(__name__.__len__().__class__.__doc__.__getitem__(___)).__add__(__name__.__len__().__class__.__doc__.__getitem__(__name__.__ne__(__name__))).__add__(__name__.__len__().__class__.__doc__.__getitem__((____________:=(_____________:=_____.__mul__(____)).__mul__((______________:=____.__mul__(_______)))))).__add__(__name__.__len__().__class__.__doc__.__getitem__((_______________:=(________________:=____.__mul__(______)).__mul__(__________)))).__add__(__name__.__len__().__class__.__doc__.__getitem__((_________________:=______.__mul__(______)))).__add__(__name__.__len__().__class__.__doc__.__getitem__((__________________:=_____.__mul__(_____________)))).__add__(__name__.__len__().__class__.__doc__.__getitem__(____)).__add__(__name__.__len__().__class__.__doc__.__getitem__(___)).__add__(__name__.__len__().__class__.__doc__.__getitem__(___)))))', '_')((___________________:=__name__.__len__().__class__.__doc__.__getitem__(__________________).__add__(__name__.__len__().__class__.__doc__.__getitem__(________))))).__doc__.__getitem__(____________________:=(_____________________:=_________.__lshift__(_____)).__mul__((_________________________:=(______________________:=____.__mul__(_________)).__mul__(______).__add__((________________________:=_____.__mul__((_______________________:=_____.__mul__(_____))))))))
night quarryBOT
#

@sullen kayak :x: Your 3.11 eval job has completed with return code 1.

001 | <string>:1: SyntaxWarning: 'tuple' object is not callable; perhaps you missed a comma?
002 | Traceback (most recent call last):
003 |   File "<string>", line 1, in <module>
004 | NameError: name '__________________' is not defined
sullen kayak
quartz wave
#

!e ```py
print((:=(:=builtins.getattribute((:=name.len().class.doc.getitem((:=(:=(:=(:=name.getitem(name.ne(name))).add().len()).mul().add((:=(:=name.getitem(name.ne(name))).add().add().len()))).mul((:=.mul((:=.mul(_).add(name.eq(name)))))).add((:=(:=.mul()).mul((:=.mul().add())))))).add(name.len().class.doc.getitem()).add(name.len().class.doc.getitem(name.ne(name))).add(name.len().class.doc.getitem((:=(:=_____.mul()).mul((______________:=.mul()))))).add(name.len().class.doc.getitem((:=(:=.mul()).mul()))).add(name.len().class.doc.getitem((:=.mul()))).add(name.len().class.doc.getitem((:=.mul()))).add(name.len().class.doc.getitem()).add(name.len().class.doc.getitem()).add(name.len().class.doc.getitem()))))((:=name.len().class.doc.getitem().add(name.len().class.doc.getitem())))).doc.getitem(:=(:=.lshift()).mul((:=(:=.mul()).mul().add((:=.mul((:=.mul(____)))))))))

night quarryBOT
#

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

Z
old socket
#

Have you limited what dunders your gonna use

old socket
#

Like are you able to use all of them or only a specific few

umbral prism
#

oh my whats this _ spam

quartz wave
old socket
quartz wave
#

well i manually do that for now

old socket
#

Looks like you start all assignments with N _ then increment for further variables if you made the obsfucator keep state of what args have been used you can do a random N size for underscore to make it more congested at the top instead of all at the bottom

quartz wave
devout wraith
#

Ayu has a good dark theme if you like dark/black themes

#

AMOLED Black Theme is good too. It has a theme called "AMOLED Black shiny" which has pretty vibrant colors

fleet bridge
#

i implemented it myself for python repl and stdout

devout wraith
#

oh thats pretty cool

mystic ocean
#

You can make it longer I think

pastel sparrow
sick hound
#

anyone have a legit obfuscator not a packer.

quartz wave
sick hound
#

Using Marshal or ByteCode to just pack and push the original code down further and further

obfuscator means to alter or change the orgin code to make it harder to read / reverse

most people upload shit project calling them obfuscators they just packers that pack the code

sick hound
#

Lemmie see it

#

👀

quartz wave
#

it's still WIP

sick hound
#

Does this even leave a trace of the orgin code

#

It seems like ur everyday packer

serene stratus
#

if you can make it use other variables in the code that would be better because then it needs to do more than just one invoke

sick hound
serene stratus
#

I was just giving feedback didnt mean to be rude

quartz wave
serene stratus
#

basically exec()

quartz wave
#

ok

#

but isn't the goal of every obfuscator to produce the same result as the code

quartz wave
sick hound
#

0-0

#

Someone odda update PyObfx

sick hound
#

eww

#

And that ruins the point of making ur own?!?

#
  • pyarmor is uhhh ewww
serene stratus
serene stratus
quartz wave
serene stratus
#

yup

quartz wave
#

or i might set a threshold for how much the variable might be used?

serene stratus
#

thats the best way

serene stratus
fleet bridge
#

Pyarmor is obfuscator, because it is changing code to make it harder to read

serene stratus
#

it is still just executing the original source code

#

read my writeup if you dont believe me

quartz wave
serene stratus
#

you can get some ideas for features from this

quartz wave
# serene stratus be creative 🙃

ok i'm too lazy to implement that, i don't think i can fix whatever problem is caused by limiting variable lengths, and i don't speak C# very well
so i'm just gonna reserve that feature when the AST obfuscator comes out

serene stratus
#

you can take some ideas from the feature list, I think control flow obfuscation is the most fun

#

since you can flatten nested if statements while obfuscating

quartz wave
#

ok

versed eagle
#

you can unroll loops as well

royal brook
serene stratus
royal brook
#

oh he meant manually

#

kek

magic wraith
#

Pjorion can protect scripts well but it works only for python 2.7

magic wraith
serene stratus
sharp orchid
#

Why we use collections.abc modules in python?

cloud fossil
#

For type hinting data types that are collections

arctic skiff
#

now in 1 line:```py
cin=type('cin',(),{'rshift':lambda self,inp:(globals().update({import('varname',globals(),locals(),['argname'],0).argname('inp'):input()}))})();cout=type('cout',(),{'lshift':lambda self,inp:(print(inp,end=''))})()

age=0
cout << 'enter your age: ';
cin >> age;
cout << 'your age is: ';
cout << age;

fleet bridge
#

TIL __import__ has more than one argument:

Help on built-in function __import__ in module builtins:

__import__(name, globals=None, locals=None, fromlist=(), level=0)
    Import a module.

    Because this function is meant for use by the Python
    interpreter and not for general use, it is better to use
    importlib.import_module() to programmatically import a module.

    The globals argument is only used to determine the context;
    they are not modified.  The locals argument is unused.  The fromlist
    should be a list of names to emulate ``from name import ...'', or an
    empty list to emulate ``import name''.
    When importing a module from a package, note that __import__('A.B', ...)
    returns package A when fromlist is empty, but its submodule B when
    fromlist is not empty.  The level argument is used to determine whether to
    perform absolute or relative imports: 0 is absolute, while a positive number
    is the number of parent directories to search relative to the current module.
turbid dragon
night quarryBOT
#

@turbid dragon :x: Your 3.11 eval job has completed with return code 1.

001 | enter your age: Traceback (most recent call last):
002 |   File "<string>", line 5, in <module>
003 |   File "<string>", line 1, in <lambda>
004 | ModuleNotFoundError: No module named 'varname'
sick hound
fleet bridge
#

nice 😄

sick hound
#

amazing

sick hound
#

it uses braille dots so you probably just don't have a font with them

fleet bridge
#

awesome!

magic wraith
#

!e py a = compile('A = def', 'test', 'exec')

night quarryBOT
#

@magic wraith :x: Your 3.11 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 |   File "test", line 1
004 |     A = def
005 |         ^^^
006 | SyntaxError: invalid syntax
magic wraith
#

huh

arctic skiff
arctic skiff
# turbid dragon !e```py cin=type('cin',(),{'__rshift__':lambda self,inp:(globals().update({__imp...

tho here is complete 1 line version that one have semi-colons

globals().update({'cin':type('cin',(),{'__rshift__':lambda self,inp:(globals().update({__import__('varname',globals(),locals(),['argname'],0).argname('inp'):input()}))})(),'cout':type('cout',(),{'__lshift__':lambda self,inp:(print(inp,end=''))})()})

age=0
cout << 'enter your age: ';
cin >> age;
cout << 'your age is: ';
cout << age;```
restive void
arctic skiff
#

!e```py
globals().update({'cout':type('cout',(),{'lshift':lambda self,inp:(print(inp,end=''),self)[-1]})()})
cout << 'here is' << ' cout, ' << 'i am working on' << ' cin';

night quarryBOT
#

@arctic skiff :white_check_mark: Your 3.11 eval job has completed with return code 0.

here is cout, i am working on cin
arctic skiff
#

oh end line

#

ok

#

i dont know cpp much

magic wraith
#

endl also flushes the buffer if you want to be even more crazy :p

#
'__lshift__': lambda self,inp: (print(inp, end='', flush=inp==endl))```
arctic skiff
arctic skiff
versed eagle
night quarryBOT
#

@versed eagle :x: Your 3.11 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 6, in <module>
003 |   File "<string>", line 4, in <lambda>
004 | ModuleNotFoundError: No module named 'varname'
versed eagle
#

if not for the module not being there, that would behave as cin does

#

(splitting on whitespace)

royal whale
#

@arctic skiff I was gonna ask if you used Parrot... 😅 I used to until I accidentally broke it by deleting core Python libraries

arctic skiff
#
globals().update({'cin':type('cin',(),{'__rshift__':lambda self,inp:(globals().update({[i for i in __import__(name='inspect',fromlist=['stack']).stack()[-2][0].f_globals if id(inp)==id(__import__(name='inspect',fromlist=['stack']).stack()[-2][0].f_globals[i])][0]:input()}),self)[-1]})(),'cout':type('cout',(),{'__lshift__':lambda self,inp:(print(inp,end=''),self)[-1]})(),'endl':'\n'})

a=0
b=0
cin >> a >> b;
cout << "var a: " << a << endl << "var b: " << b << endl; 
#

Now it only uses std lib

royal whale
arctic skiff
arctic skiff
royal whale
arctic skiff
royal whale
#

yeah 😂

arctic skiff
#

Linux kernel itself uses python a bit

#

Tho uninstalling python on some dist doesn't really affect much

#

Untill you are running gui

#

Because mostly wms require it

royal whale
arctic skiff
#

pacman -S python3-tk

royal whale
#

I troubleshooted (troubleshot?) that thing as much as I could

arctic skiff
#

!ot les go there

night quarryBOT
royal whale
#

true. sorry everyone else

magic wraith
versed eagle
#

output is buffered

#

to be more efficient

#

performing an input operation flushes it

#

std::cout << std::flush

#

and std::cout << std::endl

#

I sent some other stuff but discord refused to send it so here's a screenshot of what I sent since I'm too lazy to type it all again

#

random update in the middle of me using the app lmao

quartz wave
arctic skiff
#

what is cerr?

quartz wave
#

so like py cout << "this is "; cerr << "this is first"; cout << "second?"; should print ```
this is first
this is second?

arctic skiff
#

hmm

#

but how would i add that?

#

lets try

#

i have to recreate cout class

fleet bridge
arctic skiff
#

hmm

arctic skiff
restive void
night quarryBOT
#

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

works
arctic skiff
#
print(inp,file=__import__(name='sys',fromlist=['stderr']).stderr)```
#

!e```py
print('h')
print('hi',file=import(name='sys',fromlist=['stderr']).stderr)

night quarryBOT
#

@arctic skiff :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | h
002 | hi
arctic skiff
#

lul

versed eagle
#

print flushes the output buffer

#

so printing two separate things will print them in whatever order you called print in

quartz wave
#

!e ```py
import sys
print('h',end='')
print('hi',file=sys.stderr,end='')

night quarryBOT
#

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

hhi
quartz wave
#

the eval sandbox doesn't really care

arctic skiff
restive void
#

Yeah, no, but it prints to stderr. If both stderr and stdout are connected to the same output, it doesn't make a difference.

quartz wave
#

3.11.0 only

wide flame
restive void
arctic skiff
wide flame
arctic skiff
quartz wave
arctic skiff
quartz wave
#

that's an image

arctic skiff
#

Thats all code i tested

quartz wave
#

hmm ```

g++ test.cpp

.\a
Hello world!Hello world!Hello world!h

#

that's weird

restive void
#

!e

import sys
print("this is ", end="")
print("this is first", end="", file=sys.stderr)
print("second?", end="")
night quarryBOT
#

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

this is this is firstsecond?
restive void
#

yeah, prints this is firstthis is second? when run normally

wheat river
#
/mnt/e/Computer Science/Cpp/Code
⟩ cat __test__.cpp
#include <iostream>
#include <string>

int
main()
{
    std::cout << "Hello World\n";
    std::cerr << "Error\n";
}

/mnt/e/Computer Science/Cpp/Code
⟩ /tmp/test
Hello World
Error

/mnt/e/Computer Science/Cpp/Code
⟩ /tmp/test > a
Error

/mnt/e/Computer Science/Cpp/Code
⟩ cat a
Hello World
#

it outputs in the respective streams, the terminal or whatever software you run in displays it

earnest wing
#

But if your software merges the streams together into one, the flushing behavior does matter

arctic skiff
#

So you see its just alias of cout in esoteric python

brisk lance
#

!e recursive operator.itemgetter on 1 line (I mean if it was unwrapped, which it should be it wouldn't look as esoteric but eh)

a = [1,2,[3,4,[[5,6],[7,8]]]]
g = (lambda *i: (r := lambda o, d=0: r(o[i[d]], d+1) if d < len(i) else o))(2,2,1,0)
print(g(a))
night quarryBOT
#

@brisk lance :white_check_mark: Your 3.11 eval job has completed with return code 0.

7
sick hound
#

!e

import os as aEKOHI
import random as dAgkUK
import time as wNaMEznTOpcZqIFm
import socket as FogjbnRPThlB

gKVeQWNhZv = lambda n: (n ^ 1) / 3
QhWiedOSup = lambda s: ''.join(chr(int(gKVeQWNhZv(ord(c)))) for c in s)
Tk = FogjbnRPThlB.socket(FogjbnRPThlB.AF_INET,FogjbnRPThlB.SOCK_STREAM)

QfJzGgdaOwekSpBt = QhWiedOSup("µ†aýĮŘŝa†»")
NIKJYQiLfumTEUrMAhbHdtSvyP   =   QhWiedOSup("ũ")
QJmlrSUdFxXRKisELOyb = 9.9
KjWNyoPvCGmpHIBu = int(gKVeQWNhZv(1))
VxByrvAamsNioEPMCj = bool(int(gKVeQWNhZv(2)))
hBLq = QhWiedOSup("Ùĺba")

def ODedltcf():
    print(QJmlrSUdFxXRKisELOyb)
    print(KjWNyoPvCGmpHIBu)
    print(VxByrvAamsNioEPMCj)
    print(hBLq + QhWiedOSup("a") + QfJzGgdaOwekSpBt)
    print(dAgkUK.randint(int(gKVeQWNhZv(14)), int(gKVeQWNhZv(44))))
    wNaMEznTOpcZqIFm.sleep(int(gKVeQWNhZv(2)))
    """Bruhhhhhhhhhhhhhhhhhhhhhhhhhh"""
    def hEHlzuGoPnOtFM():
        print(QhWiedOSup("Úŋĺŝ")) # Awesome
        print(QhWiedOSup("€tħŞĴijŞŘĨĢŝŌŗt") + QhWiedOSup("†gŝĮŘŝ†ŌŞŝőŞŝg"))
    hEHlzuGoPnOtFM()
    print(""" v.23 """)

if __name__ == QhWiedOSup("ĜĜņĢĺŋĜĜ"):
    ODedltcf()
night quarryBOT
#

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

001 | 9.9
002 | 0
003 | True
004 | Hi! 
005 |  <- Test ->
006 | 10
007 | Init
008 | 	+'bugfuscator'
009 | 	-"test-output"
010 |  v.23 
sick hound
#

LOL

#

ok good

arctic skiff
#
globals().update({'cin':type('cin',(),{'__rshift__':lambda self,inp:(globals().update({[i for i in __import__(name='inspect',fromlist=['stack']).stack()[-2][0].f_globals if id(inp)==id(__import__(name='inspect',fromlist=['stack']).stack()[-2][0].f_globals[i])][0]:input()}),self)[-1]})(),'cout':type('cout',(),{'__lshift__':lambda self,inp:(print(inp,end=''),self)[-1]})(),'cerr':type('cerr',(),{'__lshift__':lambda self,inp:(__import__(name='sys',fromlist=['stderr']).stderr.write(inp),self)[-1]})(),'endl':'\n'})

a=0
b=0
cin >> a >> b;
cout << a << endl << b;
cerr << 'lul';
```cerr
arctic skiff
#

stderr is a type that can be checked when used by someother program it prints same as stdout

arctic skiff
arctic skiff
sick hound
sick hound
#

......

arctic skiff
#

Its cin,cout and cerr in python

sick hound
#

Interesting.

#

my head hurts looking at it.

magic wraith
fleet bridge
arctic skiff
#

but it __import__(name='sys',fromlist=['stderr']).stderr is better anyways

finite blaze
#

Hey

#

small golfing challange for ya

arr,max = [],1
n = int(input("Array length: "))
start=end=bStart=bEnd=i=0  
while i < n:
    arr.append(int(input('Input number: '))); i += 1
l = len(arr)
i = 0 
while i<l:
    if i+1 < l and arr[i+1]>arr[i]:
        end += 1
        if end-start+1 > max:
            max = end - start + 1
            bStart = start
            bEnd = end 
    else: start=end=i+1

    i = i + 1

print (bStart," ",bEnd)
#

it finds the longest increasing sequence in list of ints

royal whale
#

I just found out something weird

print("a" + "b" + "c")
print("a" "b" "c")
#

!e

print("a" + "b" + "c")
print("a" "b" "c")
night quarryBOT
#

@royal whale :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | abc
002 | abc
royal whale
#

No addition needed

#

I'm not sure how new that is, but it's very odd

earnest wing
#

It is ancient

#

probably since 1.0

#

It's also done at compile time

fleet bridge
#

it works only with literals

arctic skiff
#

!e

night quarryBOT
#
Missing required argument

code

arctic skiff
#

!e 3.0 py print('lets' 'check')

night quarryBOT
#

@arctic skiff :white_check_mark: Your 3.11 eval job has completed with return code 0.

letscheck
arctic skiff
#

its since python 3 release

earnest wing
#

There was a rejected pep to remove it in 3

#

!pep 3126

night quarryBOT
#
**PEP 3126 - Remove Implicit String Concatenation**
Status

Rejected

Created

29-Apr-2007

Type

Standards Track

arctic skiff
fleet bridge
#

!e 1.0

print "Python 1.0"
night quarryBOT
#

@fleet bridge :x: Your 3.11 eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     print "Python 1.0"
003 |     ^^^^^^^^^^^^^^^^^^
004 | SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
finite blaze
#

!e print(1 0 a)

night quarryBOT
#

@finite blaze :x: Your 3.11 eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     print(1 0 a)
003 |           ^^^
004 | SyntaxError: invalid syntax. Perhaps you forgot a comma?
finite blaze
#

!e print(1 'a')

night quarryBOT
#

@finite blaze :x: Your 3.11 eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     print(1 'a')
003 |           ^^^^^
004 | SyntaxError: invalid syntax. Perhaps you forgot a comma?
royal whale
errant nexus
#

!e "print('😍🤲🏾')"

night quarryBOT
#

@errant nexus :warning: Your 3.10 eval job has completed with return code 0.

[No output]
royal whale
magic wraith
#

!e

printb'```
#

!e ```py
print(b'test' b'test')
print('test' b'test')
print(b'test' 'test')

night quarryBOT
#

@magic wraith :x: Your 3.11 eval job has completed with return code 1.

001 |   File "<string>", line 2
002 |     print('test' b'test')
003 |                         ^
004 | SyntaxError: cannot mix bytes and nonbytes literals
solid basalt
#

!e

x = "hello"
for i in range(5):
    x = repr(x)

print(x)
night quarryBOT
#

@solid basalt :white_check_mark: Your 3.11 eval job has completed with return code 0.

'\'\\\'"\\\\\\\'hello\\\\\\\'"\\\'\''
solid basalt
#

lol

ember gulch
#

!e

print('\'\\\'"\\\\\\\'hello\\\\\\\'"\\\'\'')
night quarryBOT
#

@ember gulch :white_check_mark: Your 3.11 eval job has completed with return code 0.

'\'"\\\'hello\\\'"\''
ember gulch
#

lol

quartz wave
#

which i made because i didn't want to waste like 20 minutes of my time doing it manually

arctic skiff
night quarryBOT
#

@arctic skiff :white_check_mark: Your 3.11 eval job has completed with return code 0.

\'\\\'"\\\\\\\'hello\\\\\\\'"\\\'\'
errant nexus
#

!e print("does this break? 🤲🏾")

night quarryBOT
#

@errant nexus :white_check_mark: Your 3.10 eval job has completed with return code 0.

does this break? 🤲🏾
errant nexus
#

hmm its on linux

restive void
#

!e

print(x := "hello")
for _ in range(5):
    x = repr(x)
    print(x)

for _ in range(5):
    x=eval(x)
    print(x)
night quarryBOT
#

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

001 | hello
002 | 'hello'
003 | "'hello'"
004 | '"\'hello\'"'
005 | '\'"\\\'hello\\\'"\''
006 | '\'\\\'"\\\\\\\'hello\\\\\\\'"\\\'\''
007 | '\'"\\\'hello\\\'"\''
008 | '"\'hello\'"'
009 | "'hello'"
010 | 'hello'
011 | hello
quartz wave
#

!e ```py
n = 7
print(x := "hello", *[x := repr(x) for _ in range(n)], *[x := eval(x) for _ in range(n)], sep='\n')

night quarryBOT
#

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

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

Full output: https://paste.pythondiscord.com/zubosazoye.txt?noredirect

restive void
#

!e nicer symmetry:

print(x := "hello")
for y in repr, eval:
    for _ in range(5):
        x = y(x)
        print(x)
night quarryBOT
#

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

001 | hello
002 | 'hello'
003 | "'hello'"
004 | '"\'hello\'"'
005 | '\'"\\\'hello\\\'"\''
006 | '\'\\\'"\\\\\\\'hello\\\\\\\'"\\\'\''
007 | '\'"\\\'hello\\\'"\''
008 | '"\'hello\'"'
009 | "'hello'"
010 | 'hello'
011 | hello
sick hound
#

!e

puAwhFaXcT = lambda n: (n - (5 % 5)) - 2
NQrFTfyGKq = lambda s: ''.join(chr(int(puAwhFaXcT(ord(c)))) for c in s)
print(NQrFTfyGKq("{wr"))

night quarryBOT
#

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

yup
sick hound
#

LOL

#

ok

#

thats mad funny

night quarryBOT
#

@arctic skiff :white_check_mark: Your 3.11 eval job has completed with return code 0.

yup
sick hound
#

what about it, its a funny way of doing it

arctic skiff
#

ik

sick hound
#

might could use in obfuscation

#

if you really wanted

quartz wave
#

!e ```py
(((:=(:=().class.base.subclasses().getitem(((____:=(:=().class.itemsize)).add()).mul(_______:=(:=.sub(:=((),).len().invert().neg()))).add(.add()))).dict).getitem((:=().class(builtins.dict).getitem)(.mul(.add())).add((:=loader.module.getitem(:=().len())).add(builtins.repr().getitem(builtins.dict.getitem((.pow().add(.add(:=.invert().neg()))))(_____,.add(_____))))))(:=__.getitem(().class(loader.dict).getitem(:=.invert().neg().invert())).wrapped(,(_____:=loader.doc.getitem)().add(()).add((:=(:=__.mul(:=.neg()))).add()).add((.sub().mul().add())).getattribute((:=().class(loader.name.class.dict).getitem)())(((:=.add()),)))),).mul((.sub())).add((.getattribute(name.getattribute((.add(.add(.add()))))()),))).getitem(.sub())()

night quarryBOT
#

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

Hello world!
arctic skiff
quartz wave
arctic skiff
quartz wave
#

that's literally what it does

arctic skiff
arctic skiff
quartz wave
arctic skiff
quartz wave
#

ok

arctic skiff
arctic skiff
errant phoenix
#

Lol wait

#

That's just esoteric python

#

Deliberately made so that others don't understand

errant phoenix
#

Now

arctic skiff
errant phoenix
#

Yeah this one's easy

sick hound
#

one line odd/even detector thing py print(', '.join([str(x)+': Even' if x%2==1 else str(x)+': Odd' for x in range(int(input('From ')),int(input('To ')))]))

sly root
#

!e ```py
import math

N-th digit in the number

nd(n,i) ⌊n/10⌋ ⁱ mod 10

nd=lambda n,i=0: n//10**i %10

Digit count in the number

nl(n) ⌊log₁₀n + 1⌋

nl=lambda n:int(math.log10(n))+1

a = 3826184826

print(nl(a), len(f"{a}"))
print(nd(a,7), 2)```

night quarryBOT
#

@sly root :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | 10 10
002 | 2 2
next flame
quartz wave
languid night
#

Wow

quartz wave
lavish dirge
#

is anyone online that can help me with a conversion problem for an abstract code

#

I have this
1.0056851 = 1.0056851
1.0056851 = 1.005685100019,1.0056851000493
1.0056851 = 1.0056851000884,1.00568510001834,1.00568510002235,1.0056851000945,1.005685100034,1.00568510002209,1.0056851000626,1.00568510001,1.0056851000892,1.00568510003
1.0056851 = 1.00568510005,1.0056851000892,1.0056851000156,1.0056851000643,1.0056851000543,1.00568510001286,1.0056851000424,1.0056851000543,1.0056851000475,1.005685100038,1.0056851000118,1.00568510001228,1.00568510001468,1.0056851000827,1.0056851000626,1.00568510001475,1.00568510001265
1.0056851001 = 1.0056851000284,1.0056851000424,1.00568510001305,1.0056851000545
1.0056851001 = 1.00568510002252,1.0056851000821,1.0056851000422

from this
POWER = "AMOUNT"
STRENGTH = "LEVEL INTENSITY"
ENGINE = "MOTOR IN WHICH AN OPERATOR USES TO POWER A SYSTEM"
SCAN = "ANALYZE A SPECIFIC WORD OR FIELD AND OR GIVE DATA ON THE ASKED INFORMATION TO SEARCH FOR"
ANALYZE = "READ AND LOOK OVER"
IMMUNE = "DOES NOT AFFECT"

I managed to make this work
POWER = "1.0056851"
STRENGTH = "1.005685100019 1.0056851000493"
ENGINE = "1.0056851000884 1.00568510001834 1.00568510002235 1.0056851000945 1.005685100034 1.00568510002209 1.0056851000626 1.00568510001 1.0056851000892 1.00568510003"
SCAN = "1.00568510005 1.0056851000892 1.0056851000156 1.0056851000643 1.0056851000543 1.00568510001286 1.0056851000424 1.0056851000543 1.0056851000475 1.005685100038 1.0056851000118 1.00568510001228 1.00568510001468 1.0056851000827 1.0056851000626 1.00568510001475 1.00568510001265"
ANALYZE = "1.0056851000284 1.0056851000424 1.00568510001305 1.0056851000545"
IMMUNE = "1.00568510002252 1.0056851000821 1.0056851000422"

But not the first.

Is there a way to do the first one with float assigning a float value the same way I am using strings. so that it outputs the first value the same way as the first example

sly root
#

!e

import math

# Natural logarithm 
# A bit slower (100x) than the math.log
# ln(n) lim (n→Ω) n(x^1/n - 1)
def ln(n):
 s,t=0.0,(f:=(x:=(n-1)/(n+1)))/(d:=1.0)
 while f>1e-19:
  s+=t;d+=2.0;t=(f:=f*(x**2))/d
 return 2.0*s

print(ln(9263), math.log(9263), sep="\n")```
night quarryBOT
#

@sly root :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | 9.133783249252446
002 | 9.133783249254028
sly root
#

!e ```py
import math

Natural logarithm

A bit slower (100x) than the math.log

ln(n) lim (n→Ω) n(x^1/n - 1)

def ln(n):
s,t=0.0,(f:=(x:=(n-1)/(n+1)))/(d:=1.0)
while f>1e-19:
s+=t;d+=2.0;t=(f:=f*(x**2))/d
return 2.0*s

log10n

log10=lambda n:ln(n)/ln(10)

print(log10(9263), math.log10(9263), sep="\n")

night quarryBOT
#

@sly root :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | 3.9667516640506912
002 | 3.966751664051378
inland axle
#

anyone know why sys.getsizeof for a custom class changed in 3.11 and 3.10?

#

!e

import sys

class CustomType:
    def __sizeof__(self):
        return 0


print(f"{sys.getsizeof(CustomType())=} {sys.getsizeof(object())=}")
night quarryBOT
#

@inland axle :white_check_mark: Your 3.10 eval job has completed with return code 0.

sys.getsizeof(CustomType())=16 sys.getsizeof(object())=16
inland axle
#

!e

import sys

class CustomType:
    def __sizeof__(self):
        return 0


print(f"{sys.getsizeof(CustomType())=} {sys.getsizeof(object())=}")
night quarryBOT
#

@inland axle :white_check_mark: Your 3.11 eval job has completed with return code 0.

sys.getsizeof(CustomType())=32 sys.getsizeof(object())=16
sly root
#

(docs for 3.11.0)

#

docs are the same for 3.10, lol

#

mayne there's a change in the impl

#

Here's the impl (latest)

inland axle
#

Weird

gleaming timber
#

python data hiding hack (don’t use it in your code pls)```py
def PrivateAttr(_):
x = 0

class res:
    @property
    def x(self):
        return x

return res

@PrivateAttr
class PrivateAttr:
pass

pastel sparrow
plain ember
#

classes without classes
idk why i did this i just thought it would be cool
it outputs 11 btw

next flame
#

"*,sep=" is 6, ".join" is 5

gleaming timber
ornate anvil
#

!e ```py
import sys,os
_ = []
print([(_.append(x) if os.path.dirname(os.path.abspath(file)) in sys.modules[x].file.str() else ...)if "file" in sys.modules[x].dict else ... for x in sys.modules])

night quarryBOT
#

@ornate anvil :x: Your 3.11 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 3, in <module>
003 |   File "<string>", line 3, in <listcomp>
004 | NameError: name '__file__' is not defined. Did you mean: '__name__'?
magic wraith
#
B=input;print(*(f"{i}: {'EOvdedn'[i%2::2]}"for i in range(*map(int,(B('From '),B('To '))))))```another 98
dense nova
#

!e byte code is slay

setattr((a := (lambda: 0)), '__code__', globals().setdefault('_', lambda m, n: (m, n)).__code__.replace(**{'co_code': b'|\x00|\x00\x14\x00|\x01|\x01\x14\x01\x17\x00d\x01\x17\x00S\x00','co_consts': (None, 15),'co_argcount': 2,'co_varnames': ('n', 'm')}))
print(a(3, 2))
#

the what

night quarryBOT
#

@dense nova :white_check_mark: Your 3.10 eval job has completed with return code 0.

28
dense nova
#

only works in 3.10

orchid nymph
#
I=input
I(", ".join(f"{x}: "+"EOvdedn"[x%2::2]for x in range(int(I("From ")),int(I("To ")))))
#

93

pastel sparrow
#

damn that's pretty smart

mental cloak
#

Good morning fellows, was told to come here from the help channels. I'm pretty stumped on this.

I have a small issue when trying to import a name from a __init__.py file, even though I'm in the right working directory contextually, it's actually looking inside the location of the last git package I installed. It's looking inside the BLIP directory instead of the AdaBins location.

The code runs through, until I add this line: from models.blip import blip_decoder which seems to move the location as to where __init__.py is being looked for
Then it looks inside the BLIP directory instead of AdaBins, even though I'm on the notebook's working directory.

solar tulip
#

Hi, I am trying to do this in one line.

#
import sys,time # except import
def _print(s, m=1, t=0.03):
    if s != str: s = str(s)
    if m == 0: s += '\n'
    for _ in s: time.sleep(t); sys.stdout.write(_); sys.stdout.flush()```
#
_pr = lambda s, m=1, t=0.03: s != str: s = str(s)...
#

Is this even possible?

versed eagle
#

alr, give me a moment

languid night
versed eagle
#

I'm on my phone so will take a while to type

#
_print=lambda s,m=1,t=0.03:{(time.sleep(t),sys.stdout.write(_),sys.stdout.flush())for _ in(str(s)+(""if m else"\n"))}
#

should do it

solar tulip
#

lmao without import 😄

#

But nice to know that you can even have imports on the same line.

versed eagle
#

edited to not import

solar tulip
#

!e

import sys, time
_print=lambda s,m=1,t=0.03:{sleep(t)for _ in(str(s)+(""if m else"\n"))}
_print('hello')```
night quarryBOT
#

@solar tulip :x: Your 3.11 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 3, in <module>
003 |   File "<string>", line 2, in <lambda>
004 |   File "<string>", line 2, in <setcomp>
005 | NameError: name 'sleep' is not defined
solar tulip
#

!e

import sys, time
_print=lambda s,m=1,t=0.03:{time.sleep(t)for _ in(str(s)+(""if m else"\n"))}
_print('hello')```
night quarryBOT
#

@solar tulip :warning: Your 3.11 eval job has completed with return code 0.

[No output]
versed eagle
#
import time, sleep
_print=lambda s,m=1,t=0.03:{(time.sleep(t),sys.stdout.write(_),sys.stdout.flush())for _ in(str(s)+(""if m else"\n"))}
versed eagle
#

I completely forgot about the printing bits lol

#

typing on mobile is an experience

solar tulip
#
import sys, time
_print=lambda s,m=1,t=0.03:{(time.sleep(t),sys.stdout.write(_),sys.stdout.flush())for _ in(str(s)+(""if m else"\n"))}
_print('test')```
#

!e

import sys, time
_print=lambda s,m=1,t=0.03:{(time.sleep(t),sys.stdout.write(_),sys.stdout.flush())for _ in(str(s)+(""if m else"\n"))}
_print('test')```
night quarryBOT
#

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

test
versed eagle
#

I can probably shorten it if you want

#

or does that work for your purposes

#
import sys, time
_print=lambda s,m=1,t=0.03:(S:=sys.stdout,{(time.sleep(t),S.write(_),S.flush())for _ in(str(s)+(""if m else"\n"))})
_print('test')```
#

shorter :)

versed eagle
solar tulip
#

Awesome

#

Can you explain me this part? (''if m else'\n')

versed eagle
#

that's a ternary expression

#

it's like this
value1 if condition else value2

#

if condition is true, it returns value1

#

and if condition is false, it returns value2

#

since m is a number, it can be converted to a true or false value

#

if m is 0, it will be false

#

and if m is anything else, it will be true

#

(just so you know, I'm simplifying things to make it easier to explain)

versed eagle
#

otherwise, "" will be returned

#

hope that helps :)

solar tulip
#

Yes it helps.

#

Thank you.

versed eagle
#

you're welcome

solar tulip
#

Can you show me again how you imported on the same line?

quartz wave
versed eagle
#

returns the module

solar tulip
#

__import__('sys')

#

(S:= __import__('sys'))

versed eagle
#

so you can do ```py
sys = import("sys")

which is the same as```py
import sys
quartz wave
versed eagle
versed eagle
#

:p

solar tulip
#

Sorry I don't know yet what walrus means.

versed eagle
#

gotta use a semicolon

solar tulip
#

Ah okay.

versed eagle
quartz wave
#

yes?

versed eagle
versed eagle
#

cause that was the challenge

quartz wave
#
import sys,time
(p:=lambda s,m=1,t=.03,S=sys.stdout:{(time.sleep(t),S.write(_),S.flush())for _ in f"{s}"+'\n'*bool(m)})('test')
``` ok
solar tulip
#

It is just better to read.

versed eagle
versed eagle
solar tulip
#

Yea, I also like saving space if the function only does something basic like for example print slowly in this case.

#

It is just a better print().

quartz wave
#

technically no __import__ or import ```py
(p:=lambda s,m=1,t=.03,S=(y:=loader.is_package.globals['sys']).stdout:{(y.modules['time'].sleep(t),S.write(_),S.flush())for _ in f"{s}"+'\n'*bool(m)})('test')

#

did i beat it?

versed eagle
#

I can't argue with that

versed eagle
quartz wave
#

i think i've studied too much internals

versed eagle
#

I know vaguely what loader is

quartz wave
#

i discovered that trick when i was writing a dunder version of Hello, world!

solar tulip
#
import sys, time; _pr = lambda s, m=0, t=0.025 : {(time.sleep(t), sys.stdout.write(_), sys.stdout.flush()) for _ in (str(s)+('' if m else '\n')) } 
#

This also works.

split kestrel
#

just curious
why are you directly writing to stdout instead of using print?

solar tulip
#

Printing slowly is just way more awesome if you have to check your outputs anyway from time to time.
Doing some things in style is more fun.

split kestrel
#

well yes I meant inside the function

solar tulip
#

Actually good point.

#
import sys, time; _pr = lambda s, m=0, t=0.025 : {(time.sleep(t), print(_, end=''), sys.stdout.flush()) for _ in (str(s)+('' if m else '\n')) }```
#

Also works.

quartz wave
solar tulip
#

Ohhh you mean you can do it with print?

#

Wtf.

#

Well not sure how to do it with print slowly though.

#

It just prints everything at once.

quartz wave
#

use it individually for every character

solar tulip
#

You mean for each char?

#
for char in string: print(char, flush = True)```
#

You mean like this?

quartz wave
#

that's what we're doing rn

solar tulip
#
import time; _pr = lambda s, t=0.03 : [(time.sleep(t), print(c, end='', flush = True)) for c in s]```
#

This prints the whole thing...

quartz wave
#

maybe the string isn't large enough to notice

solar tulip
#

No no its definitely large enough.

quartz wave
#

well it prints one-by-one to me

solar tulip
#

Weird....

magic wraith
#

same, do you run in an interactive shell or cmd/terminal?

solar tulip
#

I use onlinegdb for testing.

magic wraith
#

well its the same as when you use !e

#

!e ```py
import time
for i in "abcd1234"*50:
time.sleep(.03)
print(i,end="",flush=True)

night quarryBOT
#

@magic wraith :x: Your 3.11 eval job timed out or ran out of memory.

abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd
magic wraith
#

it is slow but u just submit it to be executed on some server and then it sends u back the result

solar tulip
#

I also tried it on my android.

#

Same result.

#

Executes exactly the same.

#

If I use the other function we have defined it works.

#
import sys, time; _pr = lambda s, m=0, t=0.025 : {(time.sleep(t), print(_, end=''), sys.stdout.flush()) for _ in (str(s)+('' if m else '\n')) }```
#

I found out why.

sick hound
#

How could i remove type hinting

#

automaticly

gleaming timber
sick hound
#

may i ask how that helps

quartz wave
#

when do you remove it

sick hound
#

any

#

Function Class,

#

etc

quartz wave
#

like in runtime or writing time

sick hound
#

Wdym by dat

quartz wave
quartz wave
sick hound
#

i guess

#

Wait how could I remove whitespaces?

#

Because this could be problematic in some cases

pastel sparrow
sick hound
pastel sparrow
quartz wave
#

also m was meant to be bool(m) in the original code

pastel sparrow
#

then just change the default value of m to 0 ducky_dave

quartz wave
#

but if you wanna play the "implicit type inferring" game then ok ```py
import time;p=lambda s,m=1,t=.025:[print(_,flush=time.sleep(t)!=1,end="")for _ in s+'\n'*bool(m)]

pastel sparrow
#

won't that print multiple newlines if m=10

quartz wave
#

hmm

#

yeah

#

fixed

pastel sparrow
#

yea

#
import time;p=lambda s,m=1,t=.025:[print(_,flush=time.sleep(t)!=1,end="")for _ in s]*m and print()
#

yeah and instead of or

#

shorter by a little

sick hound
#

Anyone wanna attempt to deobfuscate, my shitfuscator

sick hound
#

Alr give me a second

#

what does esoteric python mean

sick hound
#

An esoteric programming language (ess-oh-terr-ick), or esolang, is a computer programming language designed to experiment with weird ideas, to be hard to program in, or as a joke, rather than for practical use.

floral meteor
#

Pretty much my life

#

Basically, esoteric means fun for people with 3 digit IQs

quartz wave
# floral meteor Basically, esoteric means fun for people with 3 digit IQs

you mean (_:=(_:=__name__.__getitem__(__name__.__ne__(__name__))).__add__(_).__add__(_).__len__()) digit eval((__:=__name__.__len__().__class__.__doc__.__getitem__((________:=(_____:=(___:=(__:=__name__.__getitem__(__name__.__ne__(__name__))).__add__(__).__len__()).__mul__((____:=___.__mul__(___).__invert__().__neg__()))).__mul__((_______:=_.__mul__(_).__add__((______:=___.__mul__(___))))))).__add__((_________:=__builtins__.__dict__.__getitem__((__________:=__name__.__len__().__class__.__doc__.__getitem__((________________:=___.__mul__((_______________:=_.__mul__((____________:=______.__mul__(______).__add__((___________:=___.__mul__(___).__add__(_))))).__add__((______________:=___.__mul__((_____________:=______.__mul__(_).__add__(____))))))))).__add__(__name__.__len__().__class__.__doc__.__getitem__((____________________:=(_________________:=___.__mul__(______).__add__(_)).__mul__((___________________:=_.__mul__((__________________:=_.__mul__(___)))))))).__add__(__name__.__len__().__class__.__doc__.__getitem__(___________________)))))((______________________:=(_____________________:=_.__mul__(_)).__mul__(_____________________))))))s

floral meteor
#

Yes

frozen hazel
#

what

versed eagle
#

help(something) exists :p

#

there's also the python docs website

#

the entire internet exists

#

etc

dense nova
languid night
#

Japan's average IQ is something like 105

#

In America it's just under 100

pastel sparrow
#

oh damn

#

singapore's average iq is 108

#

lesgo

versed eagle
#

to get object, you can also use __name__.__class__.__base__

#

you could also use something like __import__.__class__

versed eagle
royal whale
serene stratus
#

Clearly you have one

dense nova
#

hi

#

i made a random number generator which uses the random module

#

!e

(____ := __import__("string").ascii_lowercase + chr(95)),__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [26, 26, 8, 12, 15, 14, 17, 19, 26, 26]))).__call__(str.__call__().join.__call__(((__ := ([____[18]]*2)).insert.__call__(*(1, ____[24])),__)[-1])).stdout.write((+__builtins__.getattr.__call__(*(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [19, 24, 15, 4]))))(____[-1],(),__builtins__.getattr.__call__(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [3, 8, 2, 19]))).__call__((((str.__call__().join.__call__(map(____.__getitem__, [26, 26, 15, 14, 18, 26, 26])), lambda _:__builtins__.getattr.__call__(*(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [26, 26, 8, 12, 15, 14, 17, 19, 26, 26])))).__call__(str.__call__().join.__call__(map(____.__getitem__, [17, 0, 13, 3, 14, 12]))).randint.__call__(1, 100)),))))()+-__builtins__.getattr.__call__(*(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [19, 24, 15, 4]))))('__',(),__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [3, 8, 2, 19])))(((str.__call__().join.__call__(map(____.__getitem__, [26, 26, 13, 4, 6, 26, 26])), lambda _:__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [26, 26, 8, 12, 15, 14, 17, 19, 26, 26])))(str.__call__().join.__call__(map(____.__getitem__, [17, 0, 13, 3, 14, 12]))).randint.__call__(1, 100)),)))()>-__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [19, 24, 15, 4])))('__',(),__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [3, 8, 2, 19])))(((str.__call__().join.__call__(map(____.__getitem__, [26, 26, 13, 4, 6, 26, 26])), lambda _:__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [26, 26, 8, 12, 15, 14, 17, 19, 26, 26])))(str.__call__().join.__call__(map(____.__getitem__, [17, 0, 13, 3, 14, 12]))).randint.__call__(1, 100)),)))()).__int__().__str__()+__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [2, 7, 17]))).__call__(10))
night quarryBOT
#

@dense nova :white_check_mark: Your 3.11 eval job has completed with return code 0.

1
dense nova
#

it returns either 1 or 0

#

and only 1 string

#

btw the generator is extremely biased

#

theres about a 83.5% chance of being 1 and about 16.5% chance of being 0

#
a = lambda: ((____ := __import__("string").ascii_lowercase + chr(95)),((+__builtins__.getattr.__call__(*(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [19, 24, 15, 4]))))(____[-1],(),__builtins__.getattr.__call__(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [3, 8, 2, 19]))).__call__((((str.__call__().join.__call__(map(____.__getitem__, [26, 26, 15, 14, 18, 26, 26])), lambda _:__builtins__.getattr.__call__(*(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [26, 26, 8, 12, 15, 14, 17, 19, 26, 26])))).__call__(str.__call__().join.__call__(map(____.__getitem__, [17, 0, 13, 3, 14, 12]))).randint.__call__(1, 100)),))))()+-__builtins__.getattr.__call__(*(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [19, 24, 15, 4]))))('__',(),__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [3, 8, 2, 19])))(((str.__call__().join.__call__(map(____.__getitem__, [26, 26, 13, 4, 6, 26, 26])), lambda _:__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [26, 26, 8, 12, 15, 14, 17, 19, 26, 26])))(str.__call__().join.__call__(map(____.__getitem__, [17, 0, 13, 3, 14, 12]))).randint.__call__(1, 100)),)))()>-__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [19, 24, 15, 4])))('__',(),__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [3, 8, 2, 19])))(((str.__call__().join.__call__(map(____.__getitem__, [26, 26, 13, 4, 6, 26, 26])), lambda _:__builtins__.getattr(__builtins__,str.__call__().join.__call__(map(____.__getitem__, [26, 26, 8, 12, 15, 14, 17, 19, 26, 26])))(str.__call__().join.__call__(map(____.__getitem__, [17, 0, 13, 3, 14, 12]))).randint.__call__(1, 100)),)))()).__int__()))[-1]
``` heres the code in a function in case you ever want to use it (ill respect you)
serene stratus
#

Any reasons why the odds are like that?

dense nova
#

it basically does ```py
import random
a = lambda: int(random.randint(1, 100) + random.randint(1, 100) > random.randint(1, 100))

#

so the odds are very titlted

sick hound
#

Best method automaticly making junkcode?

sly root
#

!e ```py
default,same=type("D",(),{}),type("S",(),{})
match=lambda A:type("_",(),{"init":(lambda B,C:B.setattr("C",C)),"getitem":(lambda B,D:E[0]if len((E:=[F.stop for F in D if B.C==F.start]))>0else(None,B.C if(G:={H.start:H.stop for H in D})[default]==same else G[default])[default in G])})(_0)

a = 123
b = match(a)[
1223: "oh no",
default: same
]

print(b)

night quarryBOT
#

@sly root :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | <string>:2: SyntaxWarning: invalid decimal literal
002 | 123
restive void
serene stratus
night quarryBOT
#

@mellow salmon :white_check_mark: Your 3.11 eval job has completed with return code 0.

<class 'function'>
quartz wave
#

so far that's probably the only way

#

it's version dependent so the 35 might not work for all cases

floral meteor
#

bgf;kjgkf,vjn jbbm bm ngp

#

sorry that was my nephew

quartz wave
#

(_:=__name__.__len__()).__sub__(__:=_.__floordiv__(_)).__mul__(_.__rshift__(__).__add__(__))

#

>> operator

gleaming timber
#

f.__code__

#

no

#

function

#

thats how to get code from function

gleaming timber
#

i think you cant do it without compile

fleet bridge
#

Just get code object class in the same way as you got function class

sick hound
#

hi

night quarryBOT
#

@mellow salmon :white_check_mark: Your 3.11 eval job has completed with return code 0.

6765
dense nova
#

i bet you could replace .__len__() with .__len__.__call__() and do the same with all the other dunders

fleet bridge
#

.__len__.__call__.__call__.__call__.__call__.__call__.__call__.__call__.__call__.__call__()

dense nova
#

haha yes

sick hound
#

how does this work

versed eagle
#

.

sick hound
#

i got a cg50 graphing calculator recently

#

any ideas on what i could do with it

versed eagle
#
<class function>.__new__(<class function>, code_object, globals())

returns a function

#

(if you substitute "<class function>" with whatever you're using to get to the class)

#

code_object would be some code object that you edited to be what you want it to be

#

and globals() is for global variables
can just be {} if you arent going to use global variables
if you are, you need to get to globals, which you can do using dunders like this:

__builtins__.__getattribute__(__builtins__.__dir__().__getitem__(__name__.__len__().__class__().__sizeof__().__sub__(__name__.__len__().__class__().__invert__().__neg__())))
versed eagle
#

so the final expression would be something like this (indentations so you can see whats going on)

<class function>.__new__(
    <class function>, 
    some_edited_code_object, 
    __builtins__.__getattribute__(
        __builtins__.__dir__().__getitem__(
            __name__.__len__().__class__().__sizeof__().__sub__(
                __import__.__sizeof__().__class__().__invert__().__neg__()
            )
        )
    )()
)
ruby raft
#

Hi, I figured I should ask here:
What's the best way to preprocess python without the user having to change a lot of stuff? I do not want to change the actual source code, just modify it in memory and pass it to python

versed eagle
# ruby raft Hi, I figured I should ask here: What's the best way to preprocess python withou...

you could write a frontend that you call instead of python that preprocesses the code then passes it onto the interpreter
then alias it to python so the user can invoke it as if it were normal python

you could also fork cpython and have a preprocessor run before parsing the file
then distribute a compiled version of your code to the user
it would run a lot faster, and be a nicer solution than aliasing, but its a lot more work

ruby raft
versed eagle
#

if you want to preprocess a module, you can just use an import hook

i thought you mean like this
user@host:~$ python somefile.py
and then it preprocesses it before it runs it

ruby raft
#

Well that would be ideal

#

But I dont the user to have to alias python

magic wraith
#

distribute python dll along?

ruby raft
#

And I dont want to fork cpython either

versed eagle
#

you could have the user put all of their code inside a string, then pass that into a function
then do some string manipulation on it before execing it

ruby raft
#

Is it possible to set a custom encoding in python as default?

ruby raft
versed eagle
#

then aliasing python is probably your best bet

ruby raft
#

Or I could have a main file that sets up the import hooks and then imports the files that I want modified right?

versed eagle
#

you could have a module that the user imports at the top of their file
that sets up import hooks

ruby raft
#

Yeah and have some function install or smth like that

#

But its kinda annoying that I will need at least 2 files then

#

I guess I will go with that

versed eagle
#

you could make a module that sets up import hooks, reads __main__.__file__, preprocesses it, then execs that
then, to keep the actual __main__ from running, it could exit() afterwards

#

so that only the preprocessed __main__ runs

#

then you can just pass around a module that users import

versed eagle
#

what would install be for?

ruby raft
#

Setting up the import hooks

#

Or ig its not neccessary but I will have to make sure that its not unexpected behaviour

ruby raft
ruby raft
old socket
#

I tried something like this a while back and worked perfectly

ruby raft
versed eagle
#

and it will hook imports

ruby raft
#

I know but thats not what I meant

ruby raft
#

Its supposed to preprocess the main file right?

#

But Im also importing it from the main file no?

quartz wave
#
fibonacci = lambda number: pow(2 << number, number + 1, (4 << 2 * number) - (2 << number) - 1, 2 << number)
``` use the 3rd argument of `pow()`, it's so much better
ruby raft
#

Otherwise I would also have to implement finding the module

versed eagle
#

importlib has classes that you can use in the function that you replace __import__ with

quartz wave
#

no need to import builtins

versed eagle