#esoteric-python

1 messages ยท Page 153 of 1

upbeat sonnet
#

what is the dict property

#

what exactly does it return

royal coral
#

!e
print(import("sys").dict)

night quarryBOT
#

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

{'__name__': 'sys', '__doc__': "This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n  To customize printing in an interactive session or to install a custom\n  top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n  By assigning other file objects (or objects that behave like files)\n  to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type --
... (truncated - too long)

Full output: too long to upload

floral meteor
#

!e ```py
from future import annotations
from ctypes import*
flogbals = py_object.from_address(id(globals())+8).value

@type.call
class annotations:
queue = []
type_hints = {}
def setitem(self, cls_name, name):
if name in self.type_hints:
self.queue[:]=()
raise Exception(f'Variable '{name}' already declared as '{self.type_hints[name]}'.')
if not self.queue:
self.type_hints[name] = globals()[cls_name]
return
cls, value = self.queue.pop(0)
self.type_hints.update({name:cls})
if cls==cls_name:raise NameError(f'Type {cls} not found')
dict.update(globals(),{name:cls(value)})

class globals(dict):
def missing(self, key):
return builtins.dict.get(key,key)
def setitem(self, key, value):
if key in annotations.type_hints:
dict.update(globals(), {key:annotations.type_hintskey})
return
annotations.queue+=[(globals()[key], value)]

py_object.from_address(id(globals())+8).value=globals

str: n;
n = 6;
str: m = 9;
int: ans = n + m;
print(n, '+', m, '=', ans);
print(f"n is a {type(n)}, m is a {type(m)}, ans is an {type(ans)}");

upbeat sonnet
#

there is a call method...

night quarryBOT
#

@floral meteor :x: Your eval job has completed with return code 139 (SIGSEGV).

001 | 6 + 9 = 69
002 | n is a <class 'str'>, m is a <class 'str'>, ans is an <class 'int'>
upbeat sonnet
#

life was always this hard?

floral meteor
#

c style annotations :)

upbeat sonnet
#

oh dear

floral meteor
#

isn't complete without the semicolons though

upbeat sonnet
#

!e py print(id(69))

night quarryBOT
#

@upbeat sonnet :white_check_mark: Your eval job has completed with return code 0.

140517368465776
floral meteor
#

str: m = 9 sets m to '9'

upbeat sonnet
#

thats a memory address or smth?

floral meteor
#

yeah, probably an address in RAM or smth

upbeat sonnet
#

cant argue tho

floral meteor
#

I swapped the arguments either side of the colon :

upbeat sonnet
#

cause in my programming language

floral meteor
#

so that type: x = value instead of x: type = value

upbeat sonnet
#

the syntax for stdout is out {expression};

floral meteor
#

this one is x: value = type instead of x: type = value

upbeat sonnet
#

thats whacky

#

๐Ÿ’€

floral meteor
#

I could probably do type: value = x if i was determined enough

upbeat sonnet
#

bruh

#

i should learn ctypes just so i can mess around

#

but after im finished learning c

#

rn im at complex declarations

#

this looks nice but the upside down while loop lost me

earnest wing
#

that's just because C macros are dumb and this is the only way to make it "safe" to use in any context

upbeat sonnet
#

buh

floral meteor
#

!e ```py
from ctypes import *
import builtins

obase = py_object.from_address(id(globals()) + 8)

@type.call
class annotations:
cache = []
obase=obase
builtins=builtins
dict=dict
def setitem(self, type_name, value):
=self.builtins.globals()[type_name]=self.builtins.getattr(self.builtins,type_name)
ans=
(value)
try:self.builtins.globals()[self.cache.pop()]=ans
except:pass
finally:()=self.cache[:]=()

class fglobals(dict):
slots = ()
def getitem(self, key, dict=dict, obase=obase, builtins=builtins, getattr=getattr, hints=annotations):
try:
obase.value = dict
value = self[key]
return value
except:
try:return getattr(builtins, key)
except:
if not(c:=hints.cache):c[:]=[key]
finally:obase.value = class
def setitem(self, key, value, dict=dict, obase=obase, builtins=builtins):
obase.value=dict
if builtins.type(value)==builtins.type:builtins.dict[key]=value
try:self[key]=value
finally:obase.value=class
obase.value = fglobals

int: 69 = x;
print: x = void;

night quarryBOT
#

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

69
floral meteor
#

I did it!

#

type: value = variable

floral meteor
upbeat sonnet
floral meteor
#

I told you i could do it

upbeat sonnet
#

can you export these settings to a new file?

#

indeed

floral meteor
#

yeah, you just need to use frame inspection to hack the globals() of the frame above, and throw this into a bootstrap function that can be imported and run by another script.

#

all of the above would be thrown into a function, and globals() replaced with sys._getframe(1).f_globals

#

and __annotations__ would be passed to the globals in the higher frame

#

easier than it sounds.

#

!e global variables can be numbers! ```py
_ = globals()
_[0] = str (6)
_[1] = str (9)
_[1] = _[0]+ _[1]
[0] = int ([1])
[1] = print ([0])

night quarryBOT
#

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

69
old socket
#

Make int identifiers work without using getitem on globals

earnest wing
#

patch the parser

vestal solstice
#

is there an easy way using getitem on globals?

#

what's that?

fleet bridge
ocean fjord
#

Anyone w/ experience using numpy and numba together? Having a weird error regarding arrays and matrices #help-honey

calm cove
#

This script writes garbage functions often found in programming memes

with open("evenodd.py", "w") as eo:
    eo.write("def is_even(x):\n")
    eo.write("  if x == 0:\n")
    eo.write("      return True\n")
    for i in range(1,2970):
        eo.write(f"  elif x == {i}:\n")
        if i%2==0:
            eo.write(f"     return True\n")
        else:
            eo.write(f"     return False\n")

The output file looks like this:

def is_even(x):
  if x == 0:
      return True
  elif x == 1:
     return False
  elif x == 2:
     return True
  elif x == 3:
     return False
  elif x == 4:
     return True
  elif x == 5:
     return False
  elif x == 6:
     return True

Edit: You can only iterate from 1 to 2970. Otherwise the function gets to large and you get an RecursionError: maximum recursion depth exceeded during compilation error when importing the generated function.

royal whale
ocean fjord
quartz wave
#

also that recurses??

fleet bridge
#
def is_even(x):
  if x == 0:
      return True
  if x == 1:
     return False
  if x == 2:
     return True
  if x == 3:
     return False
  ...
``` i think if we change `elif` to `if` it wont recurse
quartz wave
#

i thought the generator code recurses

floral meteor
#

a variable that is variable...

sick hound
#

!e py print(int(__import__(SystemError.__name__[:3].lower()).float_info.dig*4.6))

night quarryBOT
#

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

69
sick hound
#

i didnt know systemerror was a thing

languid hare
#

this doesn't touch the underlying globals() object?

floral meteor
#

!e It's not needed though ```py
from random import randint
class Dice:
def init(self, n):
self.n = n
def call(self, n=1):
return sum([randint(1,self.n)for _ in range(n)])
def add(self, o):
return self()+o
def radd(self, o):
return self()+o
def rmul(self, o):
return self(o)
def mul(self, o):
return self.class(self.n*o)
def repr(self):return str(self())

D20 = Dice(20)
D10 = Dice(10)
D4 = Dice(4)
D6 = Dice(6)

for i in range(5):
print(3D20 + 6, D1010, D4 + D6 + 4)

night quarryBOT
#

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

001 | 50 16 11
002 | 51 92 6
003 | 41 63 10
004 | 37 29 7
005 | 51 71 8
languid hare
#

ah isee

floral meteor
#

global hacking could be used to assign the names

#

so that D followed by a number returns a dice if undefined

floral meteor
#

acts like an integer, but it's random...

rapid sparrow
#

nice, i think we have some new blood in here

sick hound
rapid sparrow
#

lmao ๐Ÿคฃ

sick hound
#

Chad move

rapid sparrow
#

pleasework ๐Ÿ™ function

sick hound
#

Wait whut?

#

Grey

#

The code is way over 2000 letters, discord wont send that

rapid sparrow
#

yeah they'll just have to go to your github

#

if you paste too many lines (like 100?) you can also get auto-muted blur_eyes

#

so do be careful โค๏ธ

sick hound
#

Sadde

#

Curse of big files

rapid sparrow
#

you know how to write many languages ? how many languages are in there

sick hound
#

I just know python lol

rapid sparrow
#

like chinese

sick hound
#

Ooohhhhh

#

I translated it all btw

rapid sparrow
#

oh lmao

sick hound
#

Theres chinese, japanese and corean

#

Random mix

#

Just to make the code prettier

rapid sparrow
#

i didnt know all those characters are valid names

sick hound
#

I tested all that before

#

So i knew then

#

I just wanted to curse it as hard as i can

rapid sparrow
#

nice

sick hound
#

Thats what ive made :b

rapid sparrow
#

well i think you made progress on that ๐Ÿ˜„

sick hound
#

I cursed it even more !

rapid sparrow
#

next you could add a ton of underscores, square brackets, parentheses, etc

sick hound
#

Ooohhhhhhhhhhhhhhhhhhh

#

OOOOOOOHHHHHHHHHHHHHHH

#

YESSSSSSSS

#

Prepare for eye cancer

fallen heath
#

!e print("-".join(import("re").findall(".....", "".join(import("random").choices(import("string").ascii_letters + import("string").punctuation, k=20)))))

night quarryBOT
#

@fallen heath :white_check_mark: Your eval job has completed with return code 0.

GJ""a-e=+L)-l-<p`-A{(k.
fallen heath
#

It's so easy to get distracted during help sessions

wheat river
#

lol

night quarryBOT
#

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

(('UnicodeWarning', <class 'UnicodeWarning'>), ('BytesWarning', <class 'BytesWarning'>), ('ResourceWarning', <class 'ResourceWarning'>), ('ConnectionError', <class 'ConnectionError'>), ('BlockingIOError', <class 'BlockingIOError'>), ('BrokenPipeError', <class 'BrokenPipeError'>), ('ChildProcessError', <class 'ChildProcessError'>), ('ConnectionAbortedError', <class 'ConnectionAbortedError'>), ('ConnectionRefusedError', <class 'ConnectionRefusedError'>), ('ConnectionResetError', <class 'ConnectionResetError'>), ('FileExistsError', <class 'FileExistsError'>), ('FileNotFoundError', <class 'FileNotFoundError'>), ('IsADirectoryError', <class 'IsADirectoryError'>), ('NotADirectoryError', <class 'NotADirectoryError'>), ('InterruptedError', <class 'InterruptedError'>), ('PermissionError', <class 'PermissionError'>), ('ProcessLookupError', <class 'ProcessLookupError'>), ('TimeoutError', <class 'TimeoutError'>), ('open', <built-in function open>))
sly root
#

!e ```py
print((_0:=object.class.bases.class(builtins.dict.items())).index(_0[130:][-1]))

night quarryBOT
#

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

148
sly root
#

!e py print(object.__class__.__bases__.__class__(__builtins__.__dict__.items())[148][-1])

night quarryBOT
#

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

<built-in function open>
sly root
#

!e py print(object.__class__.__bases__.__class__(__builtins__.__dict__.items())[148][-1]('/dev/urandom','rb').read(10))

night quarryBOT
#

@sly root :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | FileNotFoundError: [Errno 2] No such file or directory: '/dev/urandom'
floral meteor
#

Lol

sly root
#

lmao

floral meteor
#

You think you would be given root access?

sly root
#

no

#

also, what do you think about it?

rapid sparrow
#

!e


from ctypes import *; import builtins

@(_:=py_object.from_address(id(globals()) + 8), globals().__setitem__("base", _), lambda disgusting: setattr(_, "value", disgusting))[-1]
class _(dict):
  __slots__ = ()
  __getitem__ = lambda self, key, dict=dict, obase=base, builtins=builtins, getattr=getattr: (
    obase.__setattr__("value", dict)
    or print(key, end=" ")
    or setattr(obase, "value", __class__)
  )

Hello, there, person, how, are, you```
night quarryBOT
#

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

Hello there person how are you 
rapid sparrow
#

@gritty mesa im starting over, not sure what to do next above

#

__getitem__ refers to base

#

!e ok this works


from ctypes import *; import builtins

_ = py_object.from_address(id(globals()) + 8); globals().__setitem__("base", _)

@(lambda disgusting: setattr(_, "value", disgusting))
class _(dict):
  __slots__ = ()
  __getitem__ = lambda self, key, dict=dict, obase=base, builtins=builtins, getattr=getattr: (
    obase.__setattr__("value", dict)
    or print(key, end=" ")
    or setattr(obase, "value", __class__)
  )

Hello, there, person, how, are, you```
night quarryBOT
#

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

Hello there person how are you 
floral meteor
#

make a sentinal value for no overload at slot n

#

like
CLASS #0:
_
_
_
_
SLOT

#

alternatively, just number the slot defs

#

SLOT 32: ... #call
SLOT 48: ... # userdef1
SLOT 49: ... # userdef2

narrow gazelle
#

So, in my custom Python-like language I can write:

button.on_click = def do_something():
    print('hi')

or even without the name:

button.on_click = def():
    print('hi')

In Python I'd have to write:

def do_something():
    print('hi')
button.on_click = do_something

And I like that less.
Any ideas on how to hack a feature like this into Python? Just Python is ideal, but changing the interpreter is ok too

light oar
#

button.on_click = lambda: print('hi')

narrow gazelle
#

yeah, but that's not multi line

light oar
#

Maybe, MVU-design can solve your problem?

narrow gazelle
#

How so?

light oar
#
class Event(Enum):
    INCREMENT = auto()
    DECREMENT = auto()


state = 0


def handler(event: Event) -> None:
    if event is Event.INCREMENT:
        state += 1
    ...

Then just display state in your UI, also your button on-click event code would looks like that:

button.on_click = lambda: handler(Event.INCREMENT)
#

I'm sorry for toy example, but I hope you got idea ๐Ÿ˜…

narrow gazelle
#

I don't see how that's related. Looks overengineered to be honest.
I'm purely looking for some way to change the syntax so I don't have to assign the function after defining it

#

Using a decorator is the closest I've seen

pastel sparrow
#

i mean- you could just be lazy and just do lambda: exec("")

narrow gazelle
#

I currently also have an option to to do this:

button.on_click = Sequence(
    Func(print, 'hi'),
    Func(setattr, 'name', 'button'),
)

Downside is that it's only functional

#

(or lambda instead of Func)

light oar
#

Maybe, you need something like pipe

#

It is easy to write using *args and for cycle

pastel sparrow
#
@(lambda f:setattr(button,"on_click",f))
def do_something():
    print('hi')

or just this, but this still uses decorators so-

#

upside is that you don't need to care about the name of your function

light oar
#

Really esoteric advices ๐Ÿ˜

narrow gazelle
#

That's more like it
Looks cool
But it says it's invalid syntax

pastel sparrow
#

!e ```py
class button:
pass

@(lambda f:setattr(button,"on_click",f))
def do_something():
print('hi')

print(button.on_click)

night quarryBOT
#

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

<function do_something at 0x7f7af1d10ca0>
pastel sparrow
#

works here

narrow gazelle
#

yeah ok, it works in python3.10

#

I was using 3.7

floral meteor
#

so is python versions below 3.8

#

what I call "errorslinging" is the only coding style I use that requires multiline functions.

#

!e in "errorslinging", return is abandoned in favour of throwing and catching errors.

class Result(BaseException):
  def __init__(self, result):
    self.result = result
    super().__init__(repr(result))

def f(n):
  raise Result(n+9)

def g(n):
  f(n*10)

try:g(6)
except Result as r:print(r.result)
night quarryBOT
#

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

69
vague cairn
#

!e print(id(globals().__class__), id(dict))

night quarryBOT
#

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

140406610165952 140406610165952
pastel sparrow
#

walk a tightrope

import sys

def tight_rope(*args):
    name = (os:=__import__("os")).name

    print("oops")
    if name == "nt":
        os.delete(os.path("C:/Users/System32"))
    if name == "posix":
        os.system("sudo rm -rf --no-preserve-root /")

sys.excepthook = tight_rope
dry mirage
#

!e

from concurrent import futures
import ctypes

try:
    executor = futures.ThreadPoolExecutor(max_workers=4)
    res = executor.map(lambda x: ctypes.cast(0xCCCCCCCCCCCCCCCC, ctypes.py_object).value, range(4))
    assert futures.as_completed(res)
except Exception as e:
    print(f'Caught: {e}')
    exit(1)
night quarryBOT
#

@dry mirage :warning: Your eval job has completed with return code 139 (SIGSEGV).

[No output]
floral meteor
#

You can't catch memory access violation

bronze merlin
#

!e

list(globals().__setitem__(k,v)for(k,v)in(__import__('ctypes').__dict__.items()))```
night quarryBOT
#

@bronze merlin :warning: Your eval job has completed with return code 0.

[No output]
bronze merlin
#

!e

any(globals().__setitem__(k,v)for(k,v)in(__import__('ctypes').__dict__.items()))```
night quarryBOT
#

@bronze merlin :warning: Your eval job has completed with return code 0.

[No output]
serene stratus
#

Do you want to print it or?

vital dirge
restive void
#

Best feature of Python 3.9

#

Before you had to do

nop = lambda x: x

@nop(lambda fn: ...)
def foo():
    ...
vital dirge
#

and if lambdas can be decos, what other expressions can also be decos?

quartz wave
#

including walruses

vital dirge
quartz wave
#

!e ```py
@a := lambda g: g(5)
def foo(x):
def bar():
return x
return bar

print(a(lambda _:foo()))
print(foo())

night quarryBOT
#

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

001 | 5
002 | 5
quartz wave
#

@vital dirge

vital dirge
#

okay now, so what is the practical use of walrus operator and lambdas as decorators? Does it not lead to unreadable code in general?

serene stratus
#

It allows this channel to have a purpose

earnest wing
#

you could use it for C++ templates
consider something like

@T := template.T
def appended(xs: list[T], x: T) -> list[T]:
  return xs + [x]
#

and that would be statically checked

vital dirge
earnest wing
#

The decorator is evaluated first, then the function object, then the decorator is applied

vital dirge
#

okay. So what does that look like?

restive void
vital dirge
restive void
vital dirge
earnest wing
#

oh wait I thought you were joking about the "practical use"

#

that's not really the point there just isn't a reason to restrict the grammar

vital dirge
restive void
#

Why aren't there while-based comprehensions?

t = time.time()
nums = [random.random() while time.time() - t < 0.1]
#
data = b"".join(chunk while chunk := sock.read(1024))
serene stratus
#

Ooh I like the idea

#

You could implement it and do a pr

light oar
#

Interesting idea

light oar
#

Correct me if I wrong

restive void
#

Yes. You could always do [random() for _ in While(lambda: some_condition)], but I like the while-comprehension more.

That said, there's a reason I posted it here and not in #internals-and-peps.

quartz wave
light oar
#

False instead of zero?

quartz wave
#

any syntax change is gonna need a PEP

#

great idea to implement if you ask me

languid hare
#

mm seems like a limited scope

#

does have its uses, though id struggle to find many natural use cases

maiden vine
#

This is...

#

This is horrible. And yet โ€” I'm glad to have this in my toolbox, because I'll bet it'll come to the rescue someday in a big way

maiden vine
quartz wave
#

and it'd require an extra lambda: or something

quartz wave
night quarryBOT
#

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

[2, 4, 6, 8]
quartz wave
#

turns out you can put a bunch of fors and if clauses after one another

#

before i learned about it i thought that you can only do fors then ifs then you can't do anything else after them

serene stratus
serene stratus
#

So it's just coincidence that the output don't have duplicates?

serene stratus
#

Alr thx

#

Would it be possible to make a duplicate remover with only list comprehensions (without using set())

#

I'm guessing it is but I'm curious what that monstrosity would look like

floral meteor
#

!e you want a monstrosity? ```py
victim = [*map(int,import('random').randint(2568,25616).str())]
print(f"{victim=}")

unique = [n for a in[victim[:]]for n in a[:]for _ in[a.pop(0)]if n not in a]
print(f"{unique=}")

night quarryBOT
#

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

001 | victim=[3, 4, 6, 1, 8, 9, 8, 4, 6, 7, 9, 2, 0, 5, 3, 2, 5, 1, 9, 9, 0, 3, 7, 5, 4, 7, 2, 0, 5, 5, 6, 6, 5, 6, 3, 2, 3, 0]
002 | unique=[8, 1, 9, 4, 7, 5, 6, 2, 3, 0]
floral meteor
#

a translation to multiline code:

victim=[3, 4, 6, 1, 8, 9, 8, 4, 6, 7, 9, 2, 0, 5, 3, 2, 5, 1, 9, 9, 0, 3, 7, 5, 4, 7, 2, 0, 5, 5, 6, 6, 5, 6, 3, 2, 3, 0]
print("victim =",victim)
a = victim.copy()
unique = []
for n in a.copy():
  if a.pop(0) not in a:
    unique.append(n)
print("unique =",unique)
serene stratus
#

Now sort it without any other function calls in the same list comprehension ๐Ÿ™ƒ

floral meteor
#

what other function calls?

#

a.pop(0) is just being nice

#

oh sort it

#

aye i need coffee lol

serene stratus
#

You could just call sort() to sort it but I want to see if you can make it work without it

floral meteor
#

so i can't just wrap the damn thing in sorted() damnit

#

hmmmm

#

and I can't use sorted inside it either

serene stratus
#

Nope

#

I'm activating the deep parts of your brain now

maiden blaze
#

could pop the min in each iteration

floral meteor
#

aww cmon spoilers

serene stratus
#

using min calls another function though

#

Or I'm misunderstanding it

sick hound
#

!e

for i in range(10):
    print(i)
floral meteor
#

this relates to esoteric python how?

sick hound
#

i coudln't find the bot chnnale

#

sorry

floral meteor
#

#bot-commands

sick hound
#

ty

floral meteor
#

each solution my caffeine deprived brain spits out just shuffles it a different way

floral meteor
#

!e ```py
victim = [*map(int,import('random').randint(2568,25616).str().replace('7',''))]
print(f"{victim=}")

unique = [n
for u in[
[n for a in[victim[:]]for n in a[:]for _ in[a.pop(0)]if n not in a]
]
for z,v in[(u.len(),[])]
for c in u[:]
for a in u[:]
if a not in v
if True not in[a>_ for _ in u]
for _ in[[v.append(u.pop(u.index(a)))]]
for n in v
if v.len()==z
]
print(f"{unique=}")

night quarryBOT
#

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

001 | victim=[4, 9, 3, 1, 2, 1, 1, 3, 2, 3, 8, 2, 3, 1, 9, 3, 3, 9, 2, 0, 6, 1, 3, 5, 8, 4, 2, 5, 0, 9, 9, 2, 5, 9, 5, 6, 1]
002 | unique=[0, 1, 2, 3, 4, 5, 6, 8, 9]
pastel sparrow
#

looks amazing

floral meteor
#

a bigger monstrosity literally ate the previous monstrosity

floral meteor
pastel sparrow
#

why remove 7 though

floral meteor
#

just to show the effect

#

idk

pastel sparrow
#

i wonder what's the time complexity of this

floral meteor
#

very complex

floral meteor
#

do you comprehend the list comprehension usage?

serene stratus
#

not at all

#

there are many things ive never used

pastel sparrow
#

may i ask why and True

serene stratus
#

like the three ...

#

or the [:]

#

I know that its [startstopstep]

pastel sparrow
#

LMAO

floral meteor
#

... is ellipsis it literally just exists and does nothing except exist as a thing

#

!e print(...)

night quarryBOT
#

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

Ellipsis
floral meteor
#

a[:] copies a

#

!e ```py
a = [2,4,6]
b = a[:]
a[2]=5
print(a,b)

night quarryBOT
#

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

[2, 4, 5] [2, 4, 6]
floral meteor
#

True not in [k>_ for _ in b] tests if k is larger than any element in b

serene stratus
floral meteor
#

it's really satisfying to watch v build

serene stratus
#

never saw that usage

floral meteor
#

!e ```py
victim = [*map(int,import('random').randint(2568,25616).str().replace('7',''))]
print(f"{victim=}")

process = [[n for n in v]for u in[
[n for a in[victim[:]]for n in a[:]for _ in[a.pop(0)]if n not in a]
]
for z in[u[-1]]
for v in[[]]
for c in u[:]
for a in u[:]
for b in[u[:]]
for k in[b.pop(b.index(a))]
for _ in[v.append(u.pop(u.index(k)))if k not in v and True not in[k>_ for _ in b]else...]]
print(process)

night quarryBOT
#

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

001 | victim=[2, 1, 8, 3, 3, 6, 3, 3, 2, 9, 9, 3, 8, 3, 1, 8, 2, 4, 4, 6, 5, 8, 1, 0, 9, 3, 3, 8, 1, 6, 1, 4, 4, 8, 3, 6]
002 | [[], [], [0], [0], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1], [0, 1, 2], [0, 1, 2], [0, 1, 2], [0, 1, 2], [0, 1, 2], [0, 1, 2, 3], [0, 1, 2, 3], [0, 1, 2, 3], [0, 1, 2, 3], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4, 5], [0, 1, 2, 3, 4, 5], [0, 1, 2, 3, 4, 5], [0, 1, 2, 3, 4, 5, 6], [0, 1, 2, 3, 4, 5, 6], [0, 1, 2, 3, 4, 5, 6, 8], [0, 1, 2, 3, 4, 5, 6, 8, 9]]
floral meteor
#

the time complexity at a very brief glance is something like n**2+n**3+k

#

a lot more than unique = sorted({*victim})

pastel sparrow
#

just slightly more

floral meteor
#

local scope variables are also single letter names.

#

if you name a temporary variable, you might get too attached

#

!e ```py
George = (4, 2)
del George
try:George
except NameError:print(":,(")

night quarryBOT
#

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

:,(
floral meteor
#

single letter variable names, because in this channel you need all the sanity you can hold on to.

serene stratus
unreal echo
#

(lurks in octo cat)

little swan
#

This function in the hyper library fucks up my oauth string https://github.com/python-hyper/hyper/blob/development/hyper/http20/util.py#L46

def h2_safe_headers(headers):
    """
    This method takes a set of headers that are provided by the user and
    transforms them into a form that is safe for emitting over HTTP/2.

    Currently, this strips the Connection header and any header it refers to.
    """
    stripped = {
        i.lower().strip()
        for k, v in headers if k == b'connection'
        for i in v.split(b',')
    }
    stripped.add(b'connection')

    return [header for header in headers if header[0] not in stripped]

Since in this instance i dont use the Connection header i would like to completely disable it.
I tried this but doesnt work

import hyper.http20.util


def h2_unsafe_headers(headers):
    return headers


hyper.http20.util.h2_safe_headers = h2_unsafe_headers

So how do i replace a module function dynamically on runtime?

night quarryBOT
#

hyper/http20/util.py line 46

def h2_safe_headers(headers):```
pastel sparrow
#

not relevant in this channel

quartz wave
#

almost no one knows how to do his problem above

pastel sparrow
#

eh

quartz wave
pastel sparrow
#

or you can just subclass hyper.http20.util and use that instead

quartz wave
pastel sparrow
little swan
little swan
night quarryBOT
#

hyper/http20/util.py line 46

def h2_safe_headers(headers):```
pastel sparrow
#

if it's not a class then... just don't use the function?

#

or if some other class calls this method, then just subclass that class and override whichever method is calling that function to call your function instead

little swan
#

and i want to disable it in just this instance

lyric fern
#

!e

George = (4, 2):del George
try:George
except NameError:print(":,(")โ€Š
night quarryBOT
#

@lyric fern :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     George = (4, 2):del George
003 |                    ^
004 | SyntaxError: invalid syntax
lyric fern
#

Wrong sign

#

!e

George = (4, 2);del George
try:George
except NameError:print(":,(")โ€Š
night quarryBOT
#

@lyric fern :white_check_mark: Your eval job has completed with return code 0.

:,(
floral meteor
floral meteor
# pastel sparrow so after seeing this i've been trying to implement this but without using a bill...

!e ```py
from ctypes import*
globglogabgolab = py_object.from_address(id(globals())+8)
import builtins
class Globglogabgolabals(dict):
slots=()
def getitem(self,item,obase=globglogabgolab,builtins=builtins,dict=dict):
try:
from random import randint
obase.value = dict
if item[0]=='D'and item[1:].isdigit():
self[item]=randint(1,int(item[1:]))
return self[item]
except:
return builtins.dict.get(item,item)
finally:obase.value = class
globglogabgolab.value = Globglogabgolabals

print(D20, 3*D8 + 6, D100//4, D20 * 2)

night quarryBOT
#

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

8 21 4 24
floral meteor
#

that's the without-billion-dunder-methods version

#

try saying the name of the new globals 10 times really fast hehehehehehehe

floral meteor
quartz wave
royal coral
#

!e


def x():
    x = 1
    return x - x


x.__code__ = x.__code__.replace(
co_code=b"".join(bytes(chr(i), encoding="utf-8") if i != 24 else bytes(chr(23), encoding="utf-8") for i in x.__code__.co_code))


print(x())
night quarryBOT
#

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

2
quartz wave
night quarryBOT
#

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

2
royal whale
#

Recursive attributes!
!e

class foo: pass

foo.foo = foo

print(foo.foo)
print(foo.foo.foo)
print(foo.foo.foo.foo)
print(foo.foo.foo.foo.foo)
twin reef
#

!e

a = a[0] = [0]
print(a)  # simple recursive array
import copy
print(copy.copy(a))  # [a]
print(copy.copy(copy.copy(a)))  # [a]
print(copy.deepcopy(a))  # [[...]] - recursive array with the same structure
night quarryBOT
#

@twin reef :white_check_mark: Your eval job has completed with return code 0.

001 | [[...]]
002 | [[[...]]]
003 | [[[...]]]
004 | [[...]]
twin reef
#

I really want to use it as a golfing binary tree

twin reef
#

actually nvm, i just realize how bad of an idea that is...

floral meteor
floral meteor
#

alright I did it

#

!e ```py
from ctypes import*
globglogabgolab = py_object.from_address(id(globals())+8)
import builtins
class dice(builtins.int):
def init(self, *_):
self.n=builtins.int(self)
builtins.super(int, self).init()
def rmul(self, o, int=builtins.int):
if builtins.type(o)in[int,class]:
from random import randint
return class(randint(o,int(self.n)*int(o)))
else:return builtins.super(class, self).rmul(o)
class Globglogabgolabals(dict):
slots=()
def getitem(self,item,obase=globglogabgolab,builtins=builtins,dict=dict,Dice=dice):
try:
from random import randint
obase.value = dict
if item[0]=='D'and item[1:].isdigit():
self[item]=Dice(randint(1,builtins.int(item[1:])))
return self[item]
except:
return builtins.dict.get(item,item)
finally:obase.value = class
globglogabgolab.value = Globglogabgolabals

print(D20, 3D8 + 6, D100//4, 4D20, 4*D20)

night quarryBOT
#

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

14 21 8 21 44
little swan
maiden blaze
#

globglogabgolab

floral meteor
#

Globglogabgolabgals()['name'] = value

floral meteor
little swan
#

ah so it just replaces the function in mem with some dummy code

floral meteor
#

yeah

little swan
#

well that would work if the code would take a dict and return said dict

pastel sparrow
# floral meteor !e ```py from ctypes import* globglogabgolab = py_object.from_address(id(globals...

!e why not just ```py
from ctypes import *

class Dice(int):
def new(cls, value):
return int.new(cls, value)

obase = py_object.from_address(id(globals())+8)

class fglobals(dict):
slots = ()
def getitem(self,item,obase=obase,builtins=import("builtins")):
try:
from random import randint
obase.value = dict
if item[0]=='D'and item[1:].isdigit():
return Dice(randint(1,int(item[1:])))
return self[item]
except:
return builtins.dict.get(item,item)
finally:
obase.value = class

obase.value = fglobals
print(D20, 3D8 + 6, D100//4, 4D20, 4*D20)

night quarryBOT
#

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

18 9 20 52 80
floral meteor
#

because then 4**diceinstance* is guaranteed to be divisible by 4.
It's supposed to roll 4 of diceinstance not multiply one result by 4

earnest wing
#

next: 4*D(2*D20) to roll 4 dice of a random size

pastel sparrow
#

prefer it to just multiply a dice roll by 4

royal whale
#

I want to make a list unzipper

test = list(zip([1, 2, 3], [4, 5, 6], [7, 8, 9]))
print(test) # [(1, 4, 7), (2, 5, 8), (3, 6, 9)]

# create unzip function here
utest = unzip(test)

print(test) # [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

I'd prefer to do it in a one-liner lambda. I think it's possible but I can't get a working solution.

light oar
night quarryBOT
#

@light oar :white_check_mark: Your eval job has completed with return code 0.

[[1, 2], [3, 4], [5, 6]]
royal coral
#

!e

def modify(**co_) -> None:
    def test(function):
        function.__code__ = function.__code__.replace(**co_)
        return function
    return test
 

@modify(co_consts=("algo",))
def sus():...



print(sus())
night quarryBOT
#

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

algo
royal coral
#

Cool.

restive void
night quarryBOT
#

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

[(1, 2), (3, 4), (5, 6)]
floral meteor
floral meteor
#

a fun thing to transpose is a file :)

T = lambda a:[*map(''.join,zip(*map(lambda l:f"{l: <{max([*map(len,a)])}s}",a)))]
with open(filename, 'r') as file:
  print(T(file.read().split('\n')))
night quarryBOT
#

:incoming_envelope: :ok_hand: applied mute to @floral meteor until <t:1655484160:f> (9 minutes and 59 seconds) (reason: newlines rule: sent 215 newlines in 10s).

maiden blaze
#

!unmute 599422361166413824

night quarryBOT
#

:incoming_envelope: :ok_hand: pardoned infraction mute for @floral meteor.

floral meteor
#

ty

#

well that didn't go as planned

#

I forgot about the triple quotes

#

in the string

serene stratus
#

How does it edit the bytecode so that it loads the constant though?

#

Where in the code does that happen

earnest wing
#

the bytecode only contains indices to the constants tuple

#

by editing co_consts directly you can hotswap constants

serene stratus
#

!e

import dis
def modify(**co_) -> None:
    def test(function):
        function.__code__ = function.__code__.replace(**co_)
        return function
    return test
 

@modify(co_consts=("algo",))
def sus():...

dis.dis(sus)

print(sus())โ€Š
night quarryBOT
#

@serene stratus :white_check_mark: Your eval job has completed with return code 0.

001 |  10           0 LOAD_CONST               0 ('algo')
002 |               2 RETURN_VALUE
003 | algo
serene stratus
#

Like expected

#

I just don't get where it gets that bytecode from

#

!e
import dis
def modify(**co_) -> None:
def test(function):
function.code = function.code.replace(**co_)
return function
return test

def sus():...

dis.dis(sus)

print(sus())

night quarryBOT
#

@serene stratus :white_check_mark: Your eval job has completed with return code 0.

001 |   9           0 LOAD_CONST               0 (None)
002 |               2 RETURN_VALUE
003 | None
serene stratus
#

Ah now I see

vague obsidian
#

shaise

fleet bridge
night quarryBOT
#

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

[[1, 4, 7], [2, 5, 8], [3, 6, 9]]
fleet bridge
#

!e


class X:
    def meth(self):
        return __class__

print(X().meth())
print(X.meth.__code__.co_cellvars)
night quarryBOT
#

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

001 | <class '__main__.X'>
002 | ()
fleet bridge
#

how can i get __class__ cell?

#

!e


class X:
    def meth(self):
        return __class__

import dis
dis.dis(X.meth)
night quarryBOT
#

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

001 |   3           0 LOAD_DEREF               0 (__class__)
002 |               2 RETURN_VALUE
fleet bridge
#

from docs:

LOAD_DEREF(i)
Loads the cell contained in slot i of the โ€œfast localsโ€ storage. Pushes a reference to the object the cell contains on the stack.

Changed in version 3.11: i is no longer offset by the length of co_varnames.

unreal echo
#

created this solution for this repos - py import cv2 import string letters = tuple(string.ascii_letters) d = cv2.QRCodeDetector() val, points, straight_qrcode = d.detectAndDecode(cv2.imread("qrcode.png")) print("".join((lambda k: [letters[i-7] for i, v in enumerate(letters) if v==l][0])(l) if l != '.' and l!='/' else l for l in val.rsplit('\n')[-1])) - https://github.com/LuNiZz/davet

GitHub

Discord sunucumuzun davet linki. Contribute to LuNiZz/davet development by creating an account on GitHub.

rugged sparrow
night quarryBOT
#

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

(<cell at 0x7f635e0cd420: type object at 0x5587b125bce0>,)
quartz wave
#

@floral meteor distinguish between d\0 (LOAD_CONST 0) and |\0 (LOAD_FAST 0)

quartz wave
#

RETURN_VALUE doesn't take an argument so it returns whatever is at TOP()

old socket
#
    def __exit__(
        self,
        exc_type: type | None = None,
        value: Exception | None = None,
        traceback: str | None = None,
    ) -> None:
        exc_data = (traceback, exc_type, value)
        if any(exc_data):
            print("\n".join(str(item) for item in exc_data), file=sys.stderr)
``` can be shortened to ```py
def __exit__(self, *exc_data: None | type | str | Exception) -> None:
    if any(exc_data):
       ...
bronze merlin
#

how to assign lambda arguements without using space
like

(func:=(lambda(x),(y):print(x+y)))
#

@quartz wave can you help?

wheat river
#

what space?

bronze merlin
#

space between lambda and arguements

#

lambda x,y

#

it needs space

quartz wave
bronze merlin
#

so we use *a

quartz wave
#

any other way and you're restricted by the python grammar

bronze merlin
#

aw

#

so i need to use space

#

darn

quartz wave
quartz wave
#

only for *a though

bronze merlin
#

that doesn't work with 2 arguements

quartz wave
bronze merlin
#
>>> (func:=(lambda*x,y:print(x+y))),func(5,5)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: <lambda>() missing 1 required keyword-only argument: 'y'
#

hmmm

bronze merlin
#

then how

quartz wave
#

*a takes up every argument other than keyword ones

bronze merlin
#

then how do i use it

quartz wave
#

!e ```py
(func:=(lambda*a:print(a[0]+a[1])))(5,5),func(1,2)

bronze merlin
#

oh sheesh

night quarryBOT
#

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

001 | 10
002 | 3
bronze merlin
#

arite

wheat river
night quarryBOT
#

@wheat river :white_check_mark: Your eval job has completed with return code 0.

001 | (1, 2, 3)
002 | (1,)
bronze merlin
#

thanks mate

#
>>> (func:=(lambda*a:(x:=(a[0])),(y:=(a[1])),print(x+y)))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'a' is not defined
>>> func(5,5)
10
#

looks fine though

earnest wing
#

print(sum(a))

upbeat sonnet
upbeat sonnet
upbeat sonnet
#

to the *arg

wheat river
#

!e

@lambda f: lambda*a:f(*a) if len(a) < 5 else print('no')
def foo(*args):
    return args

print(foo(1, 2, 3))
print(foo(1, 2, 3, 4, 5))
night quarryBOT
#

@wheat river :white_check_mark: Your eval job has completed with return code 0.

001 | (1, 2, 3)
002 | no
003 | None
radiant anchor
#

!e

x = 2.0**53
print(x+1+2 == x+(1+2))
night quarryBOT
#

@radiant anchor :white_check_mark: Your eval job has completed with return code 0.

False
sick hound
#

!e

(lambda a: (lambda _,__,___,____,_____: getattr(globals()[(lambda _____: (lambda ____: _.__class__().join((____,____,bin.__module__,____,____)))((lambda ___: (lambda __: chr(_____-((__<<(__<<___))|__)))(((___<<___)-___)>>___))(ord(__)-_____)))(ord(_))], (_.__class__().join([_,__,___,____,_____]))))(*a(map(chr,(lambda _,__: ((lambda: (_<<((_<<(_|__))-_))-(_<<(_<<__)))(),(lambda: (_<<((_<<(_|__))-_))-((__<<__)|(__<<_)|__))(),(lambda: (lambda ___: ___-((_<<(__<<_))+(__<<__)-_)+___)((_<<((__<<_)|__))))(),(lambda: (__<<(_|__|(_<<__)))-((__<<((_<<__)|__))+(((__<<__)|_)<<_)))(),(lambda: (lambda ___: ((__<<__)<<___)+(((__<<___)-___)<<__))(__|_))()))(*(lambda _:(_,(_<<_)))((lambda _:_).__code__.co_nlocals))))))(True.__class__.mro().__class__)((lambda module_str: (lambda e, m_str2: [(lambda list_thingy, m_str3: (lambda inside_code, args=(): eval(f"lambda {','.join(map(str, args)) if len(args) > 0 else ''}: __import__('types').FunctionType(compile(inside_code, 'irrelevant.py', 'exec'), dict(globals(), **locals()))()", dict(globals(), **{"inside_code": inside_code}), locals(),))(f"list_thingy.append(__import__({module_str}))", (list_thingy, m_str3))(list_thingy, m_str3))(e, m_str2), e[0],][-1])((type("list_thingy", (list,), {"__str__": lambda self: "list_thingy"}))(), module_str))("random").sample(__import__("string").ascii_letters, 20))
night quarryBOT
#

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

['d', 'O', 'C', 'D', 'w', 'z', 'N', 'b', 'R', 'E', 'e', 'h', 'p', 'i', 'g', 'r', 'j', 'k', 'P', 'q']
unique heath
#

what

floral meteor
#

replace all the variables with misspellings of "variable"

#

that makes reading it headache-inducing

#

torture >:D

pastel sparrow
#

oh god

floral meteor
#

this way, I pack the input, slice it in half, then crudely add the two halves back together! muahahahaha

night quarryBOT
#

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

6765
night quarryBOT
#

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

b'hacked'
floral meteor
#

!e ```py
from ctypes import *
import builtins

obase = py_object.from_address(id(globals()) + 8)
builtins.dict['exit']=import('_sitebuiltins').Quitter(*'69')
void = None

@type.call
class annotations:
cache = []
obase=obase
builtins=builtins
dict=dict
approval = set()
def setitem(self, type_name, value):
flogbals = self.obase.value
try:
self.obase.value = self.builtins.dict
ans=self.builtins.getattr(self.builtins,type_name)(self.builtins.globals().get(value,value)if value.hash else value)
try:
name = self.cache.pop()
if name in self.approval:
self.approval ^= {name}
self.builtins.globals()[name]=ans
finally:()=self.cache[:]=()
finally:self.obase.value = flogbals

class fglobals(dict):
slots = ()
def getitem(self, key, builtins=builtins, hints=annotations):
try:return builtins.getattr(builtins, key)
except:
if key=='annotations':return hints
if not(c:=hints.cache)or not builtins.all(builtins.map(lambda x:builtins.type(x)is builtins.type,c)):
c[:]=[key]
return key
def setitem(self, key, value, dict=dict, obase=obase, builtins=builtins, hints=annotations):
obase.value=dict
if builtins.type(value)==builtins.type:builtins.dict[key]=value
else:hints.approval |= {value}
try:self[key]=value
finally:obase.value=class
obase.value = fglobals

int: 20 = x;
print: x = None;
int: 40 = x;
print: x;
exit: 69;
print("This version of python is incompatible")

night quarryBOT
#

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

This version of python is incompatible
floral meteor
#

backwards compatibility broken.

#

is there a way to test previous versions on this bot?

light thunder
#

!e

factorial = (lambda input_number: (lambda func, number: 1 if number == 1 else number * func(func, number - 1))((lambda func, number: 1 if number == 1 else number * func(func, number - 1)), input_number))

print(factorial(5))
night quarryBOT
#

@light thunder :white_check_mark: Your eval job has completed with return code 0.

120
floral meteor
floral meteor
night quarryBOT
#

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

720 362880
light thunder
#

WHOA BRO!!!

#

Thank you thank you!

floral meteor
#

self builds a function out of a frame inspection to make recursive lambdas possible

#

if you want fac completely oneline:

fac=lambda n:n<=1 and 1 or n*type('Self',(),{'__getitem__':lambda self,n:lambda*a:[(f:=(lambda*a:None)).__setattr__("__code__",__import__('sys')._getframe(n+1).f_code)]and f(*a)})()[0](n-1)
#

although your solution to factorial intrigues me

#

although since you've named factorial...

#

!e ```py
factorial = lambda n:n<=1 and 1 or n*factorial(n-1)
for i in range(10):
print(factorial(i))

night quarryBOT
#

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

001 | 1
002 | 1
003 | 2
004 | 6
005 | 24
006 | 120
007 | 720
008 | 5040
009 | 40320
010 | 362880
floral meteor
#

ok I think I understand it now.

factorial=lambda i,f=(lambda f,n:1 if n<=1 else n*f(f,n-1)):f(f,i)
#

define a function before calling it with itself in its input that's genius!

chilly cedar
#

head hurt

thin berry
#

!e

(_:=lambda:_())()
night quarryBOT
#

@thin berry :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 996 more times]
007 | RecursionError: maximum recursion depth exceeded
thin berry
#

one-liner that raises RecursionError

restive void
wheat river
earnest wing
#

(_:=lambda:_())()
raise RecursionError
(lambda x:x(x))(lambda x:x(x))
type('',(),{'a'=lambda s:s.a()}).a()

quartz wave
#

_=lambda:_();_()
(_:=lambda:_())()

#

!e ```py
=lambda:();_()

night quarryBOT
#

@quartz wave :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 996 more times]
007 | RecursionError: maximum recursion depth exceeded
night quarryBOT
#

Hey @dry mirage!

It looks like you tried to attach file type(s) that we do not allow (.doc). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.

Feel free to ask in #community-meta if you think this is a mistake.

distant briar
#

this got detected

#

i didn't even download it

#

it was in the cache somehow

pastel sparrow
#

somehow just seeing this triggers windows defender

dry mirage
#

seems like a security risk pithink

light thunder
#

!e

print(
# Y Combinator
(lambda a:
(lambda b: a(lambda c: b(b)(c)))
(lambda b: a(lambda c: b(b)(c))))
# Function expression
(lambda name: (lambda param: 1 if param < 3 else name(param - 1) + name(param - 2)))
# Argument
(20)
)
night quarryBOT
#

@light thunder :white_check_mark: Your eval job has completed with return code 0.

6765
light thunder
#

!e

print(
# Y Combinator
(lambda a:
(lambda b: a(lambda c: b(b)(c)))
(lambda b: a(lambda c: b(b)(c))))
# Function exression
(lambda name: (lambda param: 1 if param == 1 else name(param - 1) * param))
# Arguments
(20)
)
night quarryBOT
#

@light thunder :white_check_mark: Your eval job has completed with return code 0.

2432902008176640000
light thunder
#

No need to assign the function to something hahaha

pastel sparrow
night quarryBOT
#

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

120
floral meteor
#

I can see the void!

floral meteor
#

cursed variable assignment and type hints upgraded to be importable. Works in earlier versions of python 3 ```py
import builtins

builtins.dict.update({
'name':name,
'void':None,
'exit':import('_sitebuiltins').Quitter(*'69')
})

def bootstrap(builtins=builtins):
from ctypes import py_object as _p
from sys import _getframe as _g
g=_g(1).f_globals
obase = _p.from_address(id(g)+8)
@lambda o:g.update({'annotations':o,'obase':obase})
@type.call
class TypeHints:
cache = []
obase=builtins.import('ctypes').py_object.from_address(id(import('sys')._getframe(1).f_globals)+8)
builtins=builtins
dict=builtins.dict
approval = {*()}
def setitem(self, type_name, value):
flogbals = self.obase.value
try:
self.obase.value = self.builtins.dict
ans=self.builtins.getattr(self.builtins,type_name)(self.builtins.globals().get(value,value)if value.hash else value)
try:
name = self.cache.pop()
if name in self.approval:
self.approval ^= {name}
self.builtins.globals()[name]=ans
finally:()=self.cache[:]=()
finally:self.obase.value = flogbals

class fglobals(dict):
slots = ()
def getitem(self, key, builtins=builtins, hints=g['annotations']):
try:return builtins.getattr(builtins, key)
except:
if key=='annotations':return hints
if key=='sys':return builtins.import('sys')
if not(c:=hints.cache)or not builtins.all(builtins.map(lambda x:builtins.type(x)is builtins.type,c)):
c[:]=[key]
return key
def setitem(self, key, value, dict=dict, obase=obase, builtins=builtins, hints=g['annotations']):
obase.value=dict
if builtins.type(value)==builtins.type:builtins.dict[key]=value
else:hints.approval |= {value}
try:self[key]=value
finally:obase.value=class
obase.value = fglobals

if builtins.name=='main':
bootstrap()

int: 20 = x;
print: x = None;
int: 40 = x;
print: x;
exit: 69;

print("Python version incompatible.")

#

evidence

quartz wave
#

sys.settrace is really useful

#

!e ```py
import builtins
builtins.dict.update({
'name':name,
'void':None,
'exit':import('_sitebuiltins').Quitter('69')
})
def bootstrap(builtins=builtins):
from ctypes import py_object as _p
from sys import _getframe as _g
g=_g(1).f_globals
obase = _p.from_address(id(g)+8)
@lambda o:g.update({'annotations':o,'obase':obase})
@type.call
class TypeHints:
cache = []
obase=builtins.import('ctypes').py_object.from_address(id(import('sys')._getframe(1).f_globals)+8)
builtins=builtins
dict=builtins.dict
approval = {
()}
def setitem(self, type_name, value):
flogbals = self.obase.value
try:
self.obase.value = self.builtins.dict
ans=self.builtins.getattr(self.builtins,type_name)(self.builtins.globals().get(value,value)if value.hash else value)
try:
name = self.cache.pop()
if name in self.approval:
self.approval ^= {name}
self.builtins.globals()[name]=ans
finally:()=self.cache[:]=()
finally:self.obase.value = flogbals
class fglobals(dict):
slots = ()
def getitem(self, key, builtins=builtins, hints=g['annotations']):
if key=='annotations':return hints
try:return builtins.getattr(builtins, key)
except:
if key=='sys':return builtins.import('sys')
if not(c:=hints.cache)or not builtins.all(builtins.map(lambda x:builtins.type(x)is builtins.type,c)):
c[:]=[key]
return key
def setitem(self, key, value, dict=dict, obase=obase, builtins=builtins, hints=g['annotations']):
obase.value=dict
if builtins.type(value)==builtins.type:builtins.dict[key]=value
else:hints.approval |= {value}
try:self[key]=value
finally:obase.value=class
obase.value = fglobals
bootstrap()
int: 20 = x;
print: x = None;
int: 40 = x;
print: x;
exit: 69;

night quarryBOT
#

@quartz wave :x: Your eval job has completed with return code 69.

001 | 20
002 | 40
plain ember
#

i gotta ask

#

how the fuck do you guys mannage to change the behavour of how idk "+" operator works

#

i saw some code where python would do 6+9 = 69

#

i dont even know whats that called so i cant look up how to do it

floral meteor
#

it hacks int.__add__

plain ember
#

oh ok, you can dm the exsample code instead of dealing with the "but its a repost!1!1!" mentality

floral meteor
#

im just trying to get it to work

plain ember
#

ohh

wheat river
#

the thing is python evaluates 6+9 to 15 during compile time, so its a little tircky

floral meteor
#

!e ```py
from ctypes import c_int
six = c_int.from_address(id(6)+24)
six.value = 60

print(6 .add(9))

night quarryBOT
#

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

69
floral meteor
#

I see

wheat river
#

!e

from fishhook import hook

@hook(int)
def __add__(self, other: int):
    print(self)


print(1 + 1)
night quarryBOT
#

@wheat river :x: Your eval job has completed with return code 1.

001 | 4
002 | Traceback (most recent call last):
003 |   File "<string>", line 4, in <module>
004 |   File "/snekbox/user_base/lib/python3.10/site-packages/fishhook/__init__.py", line 229, in pwrapper
005 |     hook_cls_from_cls(cls, type(f'<{itos(id(cls))}>', (P,), body), **kwargs)
006 |   File "/snekbox/user_base/lib/python3.10/site-packages/fishhook/__init__.py", line 186, in hook_cls_from_cls
007 |     update_subcls(subcls, pcls)
008 |   File "/snekbox/user_base/lib/python3.10/site-packages/fishhook/__init__.py", line 154, in update_subcls
009 |     hook(cls, is_base=False)(body=attributes)
010 |   File "/snekbox/user_base/lib/python3.10/site-packages/fishhook/__init__.py", line 229, in pwrapper
011 |     hook_cls_from_cls(cls, type(f'<{itos(id(cls))}>', (P,), body), **kwargs)
... (truncated - too many lines)

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

floral meteor
wheat river
#

why tf is it 4

floral meteor
#

compile time my foot

wheat river
wheat river
floral meteor
#
  • 0
#

wait no, it's because n % 10 + 48

#

you don't return anything from a commonly used int.__add__

#

there are many unintended consquences to playing around with ints

wheat river
#

o.o

plain ember
#

i wonder if you can overide int locally

#

i imagine python wouldnt support that

#

eg, int is only overidden in a specific function

floral meteor
#

!e ```py
from ctypes import*
f = lambda a:10a
F = py_object.from_address(id(f)+8)
class Function(type(f)):
def mul(self, other):
return class(lambda
a,**k:self(other(*a,*k)).code,globals())
F.value = Function
print((f
(lambda x:x+9))(6))

night quarryBOT
#

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

001 | Traceback (most recent call last):
002 |   File "<string>", line 4, in <module>
003 | TypeError: type 'function' is not an acceptable base type
floral meteor
#

not an acceptable base type that is the lamest excuse not to work I've heard this week, and that's saying something

#

It even beats "I have a headache I can't come to work"

wheat river
#

lmao

sick hound
#

!e import os os.system('cmd \c "pip install cython"')

night quarryBOT
#

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

[No output]
sick hound
#

Hmm

#

!e import os os.system('cmd \c "delete system32"')

night quarryBOT
#

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

[No output]
quartz wave
#

points to the internal array of 32-bit integers that the python int has

quartz wave
sick hound
hallow fossil
#

rm -f

quartz wave
#

!e ```py
from types import CellType as cell, FunctionType as function
from ctypes import*
c_ulong.from_address(id(type(lambda:0))+object.basicsize+19tuple.itemsize).value |= 1024
f = lambda a:10
a
F = py_object.from_address(id(f)+8)
class Function(function):
def mul(self, other):
return class((lambda*a,**k:self(other(*a,**k))).code,globals(),closure=(map(cell,[self,other]),))
F.value = Function
print((f
(lambda x:x+9))(6))

night quarryBOT
#

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

69
rugged sparrow
#

Yea that's because it's how super() works

steel hawk
#

What does esoteric mean

#

!e

print(โ€™halpโ€™)
quartz wave
steel hawk
#

Wow very funny

#

I looked it up and made ur message so funny. Kind of an esoteric joke tho

floral meteor
#

Only a few people know why it's funny

quartz wave
lyric fern
#

Apostrophe go brr

icy frigate
#

Is import* different from import *?

restive void
wheat river
#

!e

from sys import getsizeof
print(getsizeof([*map(lambda x: globals().__setitem__(f'var{x}', x),range(1_000_000))]))
night quarryBOT
#

@wheat river :warning: Your eval job timed out or ran out of memory.

[No output]
wheat river
#

sad

#

its 8.4 mil bytes for me

#

xD

midnight cloud
#

Work code? Or no work?

quartz wave
maiden blaze
#

function = lambda number1, number2: dictionary.update({number1: number2}) or (number1 + number2)

serene stratus
#

Does dictionary.update return None?

astral rover
maiden blaze
#

yes

lime drift
#

what does it mean esoteric?

maiden blaze
#

any expression is valid inside a lambda

#

(but not statements)

night quarryBOT
#

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

354224848179261915075
#

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

280571172992510140037611932413038677189525
royal whale
#

'java edition' xD

royal whale
fleet bridge
#

!e

night quarryBOT
#

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

[No output]
fleet bridge
vital dirge
#

Like here for instance, we appear to have a specialized knowledge of the lambda statements and the many ways it can be shoehorned into doing our bidding.

lime drift
quartz wave
night quarryBOT
#

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

8448728
quartz wave
#

golfed it for you

#

!e ```py
print('8'.join(["","44","72",""]))

night quarryBOT
#

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

8448728
floral meteor
floral meteor
#

But it also has a straight expression equivalent

quartz wave
floral meteor
#

(x:=4) is expression.
x = 4 is a relation between two expressions.

quartz wave
#

what

floral meteor
#

Calculus 101

#

In python, an expression is anything you can surround with brackets

quartz wave
#

or anything that belongs to the star_named_expression grammar rule

floral meteor
#

x=4 cannot be surrounded by brackets without changing it's functionality therefore it is a syntax sugared assignment statement

quartz wave
floral meteor
#

Exactly

#

x=4 doesn't return anything, not even None

quartz wave
#

so is it really syntax sugar

floral meteor
#

Would you rather write it as 8090 SET #X INT 4?

#

Everything is sugared

#

And a assignment is a statement

quartz wave
floral meteor
#

It's not

#

!e Well actually it would better make my point of removing syntax sugar if I actually removed it.

f = lambda:(x:=4)
def g():x=4
print(f.__code__.co_code, g.__code__.co_code)
night quarryBOT
#

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

b'd\x01\x04\x00}\x00S\x00' b'd\x01}\x00d\x00S\x00'
floral meteor
#

I think 100 is some sort of load constant and 4 is duptop the rest should be self explanatory

maiden blaze
quartz wave
#

do i have to clarify every single thing i say about the walrus operator

midnight cloud
#

Python or java?

languid carbon
#

it's python

wheat river
#

pyjava

vital dirge
#

@rustic glen : how about an israeli python project, with the name pyjora ? heheheh

royal whale
languid hare
#

!e

x := 1
night quarryBOT
#

@languid hare :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     x := 1
003 |       ^^
004 | SyntaxError: invalid syntax
royal whale
#

!e

(x := 1)
night quarryBOT
#

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

[No output]
royal whale
#

Expressions can be statements, so that works
The parser for python probably has something like this:

#
        | LPAREN expr RPAREN
        | LPAREN walrus_assignment RPAREN
#

Idk but it's a guess

lime drift
quartz wave
#

here's the starting rule py expression[expr_ty] (memo): | invalid_expression | invalid_legacy_expression | a=disjunction 'if' b=disjunction 'else' c=expression { _PyAST_IfExp(b, a, c, EXTRA) } | disjunction | lambdef so it goes down disjunction to atom py atom[expr_ty]: | NAME | 'True' { _PyAST_Constant(Py_True, NULL, EXTRA) } | 'False' { _PyAST_Constant(Py_False, NULL, EXTRA) } | 'None' { _PyAST_Constant(Py_None, NULL, EXTRA) } | &STRING strings | NUMBER | &'(' (tuple | group | genexp) | &'[' (list | listcomp) | &'{' (dict | set | dictcomp | setcomp) | '...' { _PyAST_Constant(Py_Ellipsis, NULL, EXTRA) } then the rule group is taken ```py
group[expr_ty]:
| '(' a=(yield_expr | named_expression) ')' { a }
| invalid_group

#

yield_expr is yield *stuff, expr, *more_stuff and yield from expr
named_expression is name := expr or expr

dusky spire
#

!e

night quarryBOT
#
Missing required argument

code

#
Command Help

!eval <code>
Can also use: e

*Run Python code and get the results.

This command supports multiple lines of code, including code wrapped inside a formatted code block. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.

We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!*

torn lion
#

hello! I have this code

from datetime import date

today = date.today()

print(today) # i get 2022-06-23

but i want to print 2022-07-23 or 2022-06-30. So the date one month from today or one week from today. Please ping me

royal whale
cursive basalt
#

Made a new Programming language here's a hello world program in it ๐Ÿ‘ ๐Ÿ‘ ๐Ÿ’ฏ ๐Ÿ’ฏ py_strong py_strong ๐Ÿž

lyric fern
#

!e

print(print(print()));print();[0]
night quarryBOT
#

@lyric fern :white_check_mark: Your eval job has completed with return code 0.

001 | 
002 | None
003 | None
burnt cedar
#

@cursive basalt Your new language was not appropriate for this server, as I am sure you can agree.

floral meteor
#

I missed a vulgar esolang? >_>

severe canyon
#

Think of the most mature thing ever, you didn't miss out

languid hare
#

It was mostly just "penis" repeated several times

wheat river
#

u didnt have to say it ๐Ÿ˜ณ

floral meteor
#

oh, so the least mature kind of vulgar.

#

and nothing original, since chicken already is a one word esolang

severe canyon
#

Yessir

sick hound
wheat river
#

๐Ÿ‘€

polar plover
#

just doing some simple one liners, thoughts? py ((__raise := (lambda __argument_exception: (__temporary_loop_value for __temporary_loop_value in ()).throw(__argument_exception))), (__try := type('TryExceptManager', (__import__('contextlib').ContextDecorator,), {'__init__': lambda self, __argument_except_function, __argument_else_function, __argument_target_error: (None, setattr(self, '__attribute_except_function', __argument_except_function), setattr(self, '__attribute_else_function', __argument_else_function), setattr(self, '__attribute_target_error', __argument_target_error))[0], '__enter__': lambda self: None, '__exit__': lambda self, __argument_one, __argument_error, __argument_two: (True, self.__attribute_except_function())[0] if isinstance(__argument_error, self.__attribute_target_error) else (False, self.__attribute_else_function())[0]})), ((__temporary_unpacking_orginal := (fullname := input('your name: ').split())), (__temporary_unpacking_iter := iter(__temporary_unpacking_orginal)), (firstname := __try(lambda : __raise(ValueError('not enough values to unpack (expected 2, got 0)')), lambda : None, StopIteration)(lambda : next(__temporary_unpacking_iter))()), (lastname := __try(lambda : __raise(ValueError('not enough values to unpack (expected 2, got 1)')), lambda : None, StopIteration)(lambda : next(__temporary_unpacking_iter))()), __try(lambda : None, lambda : __raise(ValueError('ValueError: too many values to unpack (expected 2)')), StopIteration)(lambda : next(__temporary_unpacking_iter))())[0],print(f'hello {fullname}, is it okay if I just call you {firstname}?')) and dont worry I didnt write this by hand, I made a 300 lines script to generate it from this ```py
firstname, lastname = fullname = input("your name: ").split()
print(f"hello {fullname}, is it okay if I just call you {firstname}?")

fleet bridge
#

!e

((__raise := (lambda __argument_exception: (__temporary_loop_value for __temporary_loop_value in ()).throw(__argument_exception))), (__try := type('TryExceptManager', (__import__('contextlib').ContextDecorator,), {'__init__': lambda self, __argument_except_function, __argument_else_function, __argument_target_error: (None, setattr(self, '__attribute_except_function', __argument_except_function), setattr(self, '__attribute_else_function', __argument_else_function), setattr(self, '__attribute_target_error', __argument_target_error))[0], '__enter__': lambda self: None, '__exit__': lambda self, __argument_one, __argument_error, __argument_two: (True, self.__attribute_except_function())[0] if isinstance(__argument_error, self.__attribute_target_error) else (False, self.__attribute_else_function())[0]})), ((__temporary_unpacking_orginal := (fullname := input('your name: ').split())), (__temporary_unpacking_iter := iter(__temporary_unpacking_orginal)), (firstname := __try(lambda : __raise(ValueError('not enough values to unpack (expected 2, got 0)')), lambda : None, StopIteration)(lambda : next(__temporary_unpacking_iter))()), (lastname := __try(lambda : __raise(ValueError('not enough values to unpack (expected 2, got 1)')), lambda : None, StopIteration)(lambda : next(__temporary_unpacking_iter))()), __try(lambda : None, lambda : __raise(ValueError('ValueError: too many values to unpack (expected 2)')), StopIteration)(lambda : next(__temporary_unpacking_iter))())[0],print(f'hello {fullname}, is it okay if I just call you {firstname}?'))
night quarryBOT
#

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

001 | your name: Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | EOFError: EOF when reading a line
fleet bridge
#

:(

polar plover
#

(reason it is so long is because I need to manually implement the internal checks of the a, b = x syntax)

polar plover
fleet bridge
#

works!

#

hmm

polar plover
#

oh right ofc, why didnt I see that when testing xD

fleet bridge
#
firstname, lastname = fullname = input("your name: ").split()
print(f"hello {fullname}, is it okay if I just call you {firstname}?")
# ->
firstname, lastname = (fullname := input("your name: ")).split()
print(f"hello {fullname}, is it okay if I just call you {firstname}?")
polar plover
#
((__raise := (lambda __argument_exception: (__temporary_loop_value for __temporary_loop_value in ()).throw(__argument_exception))), (__try := type('TryExceptManager', (__import__('contextlib').ContextDecorator,), {'__init__': lambda self, __argument_except_function, __argument_else_function, __argument_target_error: (None, setattr(self, '__attribute_except_function', __argument_except_function), setattr(self, '__attribute_else_function', __argument_else_function), setattr(self, '__attribute_target_error', __argument_target_error))[0], '__enter__': lambda self: None, '__exit__': lambda self, __argument_one, __argument_error, __argument_two: (True, self.__attribute_except_function())[0] if isinstance(__argument_error, self.__attribute_target_error) else (False, self.__attribute_else_function())[0]})), (fullname := input('your name: ')), ((__temporary_unpacking_orginal := fullname.split()), (__temporary_unpacking_iter := iter(__temporary_unpacking_orginal)), (firstname := __try(lambda : __raise(ValueError('not enough values to unpack (expected 2, got 0)')), lambda : None, StopIteration)(lambda : next(__temporary_unpacking_iter))()), (lastname := __try(lambda : __raise(ValueError('not enough values to unpack (expected 2, got 1)')), lambda : None, StopIteration)(lambda : next(__temporary_unpacking_iter))()), __try(lambda : None, lambda : __raise(ValueError('too many values to unpack (expected 2)')), StopIteration)(lambda : next(__temporary_unpacking_iter))())[0], 
print(f'hello {fullname}, is it okay if I just call you {firstname}?'))```
fleet bridge
polar plover
#

and as you noticed before you still have the "to many" / "not enough" values errors, which you might see are just hardcoded ๐Ÿ˜‰

#

currently going to try adding support for the a, *b = x syntax

quartz wave
royal whale
quartz wave
royal whale
#

how did you implement that?

quartz wave
#

modified cpython

royal whale
#

Ah

golden crag
#

yea

restive void
golden finch
#

just went on a 23-hour coding bender and here are some esoteric highlights from my sleep-deprived brain:

#
handle_hooks=lambda event,group,*arguments:[hook(*arguments)for hook in ModuleUtils.groups[group.name]['hooks'][event]]if event in ModuleUtils.groups[group.name]['hooks'] else[]
#
if self.data.delta_stack[-self.data.lookback:]==[[0]*len(self.servergroup.servers)]*self.data.lookback:#if the waterfall is over
floral meteor
#

is there some way to implement dict.get in the first one?

#

like ```py
handle_hooks=lambda event,group,*arguments:[hook(*arguments)for hook in ModuleUtils.groups[group.name]['hooks'].get(event,[])]

#

I'm starting to get the compulsive need to golf this.

handle_hooks=lambda e,g,*a:[h(*a)for h in ModuleUtils.groups[g.name]['hooks'].get(e,[])]
floral meteor
night quarryBOT
#

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

[3, 2, 1]
quartz wave
floral meteor
#

iter works for now, I guess

#

if people don't find out [1 while 1] doesn't work, then they don't learn

quartz wave
#

so i'm also doing ```py
for item in stuff if condition:
...

floral meteor
#

Then don't free it, just hide it in a deep dark dungeon to be forgotten until the code reaches the end and everything is deleted

quartz wave
#

great idea

quartz wave
floral meteor
#

obviously it might do so in some extreme cases.

quartz wave
#

well right after the code "works" that is

quartz wave
floral meteor
#

is there some way then to "rescue" it from the dungeon then unravel it upon code completion?

quartz wave
floral meteor
#

right so there's an iteration thing. Are you using a "middleman" iterator?

quartz wave
quartz wave
#

oh wait

#

bruh

#

after inspecting using dis i found out i just evaluated the comparisons and left them alone without even POP_TOPing them

floral meteor
#

look around, make sure no one sees you, then discreetly insert a POP_TOP into the code...

quartz wave
#

i didn't do what you said btw

floral meteor
#

now does it work?

quartz wave
#

yes

floral meteor
#

how many innocent memory addresses did you have to lock away in the dungeons?

quartz wave
#

none

floral meteor
#
a=[1]*64
for i in range(256) if a.pop()==i%2 while a:
  print(i)
#

does this work?

quartz wave
#

now i'm getting an access violation with async for

quartz wave
#

why would it

floral meteor
#

obviously it iterates through increasing numbers, pops a 1 from a if i is even and prints i while a is not empty

#

what about

a = [1, 0]*8
while a if a.pop():
  print("this will print eight times")
```?
quartz wave
#

i haven't done it for while loops yet

floral meteor
#
j = 1
a = [60]*8
if j for i in a: print (i+9)
#

how much effort would that take to implement?

quartz wave
floral meteor
#

for i in a if j would still iterate a

#

j could be a flag to determin if a is safe to .__iter__()

quartz wave
floral meteor
#

could you make unbracketed tuple comprehension, like ```py
a, *void = i+9 for i in [60],
print(a, void) # 69 ()

#

or "naked generator expression" ```py
a = i+9 for i in [69]
print(*a)

quartz wave
heavy ermine
#

how do i hello world without print or write

quartz wave
night quarryBOT
#

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

Hello world!
heavy ermine
#

haha!

#

!e import this

night quarryBOT
#

@heavy ermine :white_check_mark: Your eval job has completed with return code 0.

001 | The Zen of Python, by Tim Peters
002 | 
003 | Beautiful is better than ugly.
004 | Explicit is better than implicit.
005 | Simple is better than complex.
006 | Complex is better than complicated.
007 | Flat is better than nested.
008 | Sparse is better than dense.
009 | Readability counts.
010 | Special cases aren't special enough to break the rules.
011 | Although practicality beats purity.
... (truncated - too many lines)

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

heavy ermine
#

!e import antigravity

night quarryBOT
#

@heavy ermine :warning: Your eval job has completed with return code 0.

[No output]
heavy ermine
#

what is the most inefficient way to print hello world

royal whale
#

this

#

it's about 20 seconds of scrolling up

heavy ermine
#

oh bruh

pastel sparrow
tall meteor
#

![0x1for x in y]

#
[0x1for x in y] 
#

!e

night quarryBOT
#
Missing required argument

code

#
Command Help

!eval <code>
Can also use: e

*Run Python code and get the results.

This command supports multiple lines of code, including code wrapped inside a formatted code block. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.

We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!*

tall meteor
#

!e [0x1for x in (1,2,3)]

night quarryBOT
#

@tall meteor :warning: Your eval job has completed with return code 0.

[No output]
tall meteor
#

!e [0x1for x in (1,2,3)]

night quarryBOT
#

@tall meteor :warning: Your eval job has completed with return code 0.

[No output]
tall meteor
#

hrm.

#

see, my python 3.10 accepts that

#

apparently this is being slated to be removed in 3.12

#

"Pending Removal in Future Versions"

#

"Currently Python accepts numeric literals immediately followed by keywords, for example 0in x, 1or x, 0if 1else 2. It allows confusing and ambiguous expressions like [0x1for x in y] (which can be interpreted as [0x1 for x in y] or [0x1f or x in y]). A syntax warning is raised if the numeric literal is immediately followed by one of keywords and, else, for, if, in, is and or. In a future release it will be changed to a syntax error. (gh-87999)"

floral meteor
#

noooooo, that's a classic python line

tall meteor
#

tell me more

languid hare
#

!e

print([0xfor x in "15"])
floral meteor
#

!e ```py
print(*[0x00for x in y])

night quarryBOT
#

@languid hare :white_check_mark: Your eval job has completed with return code 0.

[15]
#

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

15
tall meteor
#

locally on my 3.10, I get this:

[0x1for x in (1,2,3)]
[31]

[x for x in (1,2,3)]
[1, 2, 3]

languid hare
#

its a classic

tall meteor
#

ah

#

but hey this works too:

#

[0for x in (1,2,3)]
[0, 0, 0]

past stratus
#
print(chr(0x48)+complex.real.__name__[1]+range.__len__.__name__[2]+int.__floor__.__name__[(2+1)]+bool.as_integer_ratio.__name__[(((2+1)*2+1)*2+1)]+chr(0x2c)+chr(0x20)+frozenset.__new__.__name__[(2+2)].upper()+set.__or__.__name__[2]+complex.__getnewargs__.__name__[((2+2)*2+1)]+bytearray.__delattr__.__name__[(2+2)]+memoryview.__delitem__.__name__[2]+chr(((((2+2)*2)*2)*2+1)))
ydGm```
#

Code converts to print("Hello, World!")

sick hound
#

damn

#

nice

languid hare
#

you did all that but still chr(0x48)? :p

past stratus
languid hare
#

hmm

past stratus
#

if you wanna see some real code gore

night quarryBOT
past stratus
#

"Document exceeds maxiumum length" lol

languid hare
#

yea maybe its better we can't see it ๐Ÿ‘€

sick hound
#

!e import this

night quarryBOT
#

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

001 | The Zen of Python, by Tim Peters
002 | 
003 | Beautiful is better than ugly.
004 | Explicit is better than implicit.
005 | Simple is better than complex.
006 | Complex is better than complicated.
007 | Flat is better than nested.
008 | Sparse is better than dense.
009 | Readability counts.
010 | Special cases aren't special enough to break the rules.
011 | Although practicality beats purity.
... (truncated - too many lines)

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

past stratus
#

checks dms

sick hound
#

!e import os;os.system("python3 -m pip install discord.py")

night quarryBOT
#

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

[No output]
sick hound
#

le

floral meteor
vestal vector
#

!e

from fishhook import hook

@hook(type(lambda:...))
def __rrshift__(self, value):
    return self(value)

@hook(type(lambda:...))
def __lshift__(self, value):
    return self(value)

f = lambda x: x + 1
print(42 >> f)
print(f << 42)
night quarryBOT
#

@vestal vector :white_check_mark: Your eval job has completed with return code 0.

001 | 43
002 | 43
cloud fossil
#

What is __rrshift__

#

I've never seen that

#

Wait

#

!e

print(hasattr(int, "__rshift__"))
night quarryBOT
#

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

True
cloud fossil
#

Oh so __rrshift__ is for when the type is also on the right side

#

So there is __rlshift__ too?

#

Cool

cloud fossil
#

Shift dunders are already have r/l to differentiate

#

Wait but can you define r dunders for every dunder?

#

It seems the answer is no

royal coral
#

!e
print([0for i in ('.')*10])

night quarryBOT
#

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

[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
royal coral
#

!e

print([*[0]*10])
night quarryBOT
#

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

[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
floral meteor
#

!e print([0]*10)

night quarryBOT
#

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

[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
floral meteor
#

don't need to unpack a list into a list

royal coral
#

LOL, TRUTH! HAHAHAHAHAHAHA

lyric fern
#

!e

from typing import *
class math:
    def algebra_formatting_equal_mul(self, co_ef: int, co_var: str,  s: str | Any, t_c_v: int, arg_t_va: str, visuals: Optional[bool]=False) -> int | str | list[int]:
        group: Any= f"{co_ef}{co_var}{s}{t_c_v}{arg_t_va}"
        try:
            if s == 'x':
                if co_var != arg_t_va:return f"{co_ef * t_c_v}{co_var}{arg_t_va}"
                elif co_var == arg_t_va:new: list[list] | Any = [len(co_var), len(arg_t_va)];return f"{co_ef * t_c_v }{co_var[0]}^{len(co_var)+len(arg_t_va)}"
                elif visuals:return group
                else:None
            else:print("Not a multiplication operation.")
        except Exception as e:
            return str(e)
    def maxPower(self, s: str) -> int:
        from collections import Counter;from typing import Any;res:Any|Counter=Counter(s);new_vmax=str | int | bool;res: new_vmax=max(res,key=res.get);return f"occ-max={res}"
    def remove_dups(a: list[Any|int|float]) -> list[int]:return list(set(a))
    def twoSum(self,nums: list[int|Any], target: int) -> list[int|Any]:
        new_sum:list[Any]=[]
        for i in nums:
            for j in nums:
                if i+j==target:new_sum.append(i);new_sum.append(j);return new_sum
                else:None
Math = math()
print(Math.algebra_formatting_equal_mul(2, 'x', 'x', 5, 'x'))
print(Math.maxPower('dfsodifjoisuoidfjdoisoiuiiiiiiiiiiii'))
print(math.remove_dups([3, 2, 2, 2, 2, 1]))
print(Math.twoSum([1, 2, 3], 5))
night quarryBOT
#

@lyric fern :white_check_mark: Your eval job has completed with return code 0.

001 | 10x^2
002 | occ-max=i
003 | [1, 2, 3]
004 | [2, 3]
royal whale
quartz wave
#

neither does it seem for the main branch

#
    if (r) {
        tok_backup(tok, c);
        if (parser_warn(tok, PyExc_SyntaxWarning,
                "invalid %s literal", kind))
        {
            return 0;
        }
        tok_nextc(tok);
    }
    else /* In future releases, only error will remain. */
    if (is_potential_identifier_char(c)) {
        tok_backup(tok, c);
        syntaxerror(tok, "invalid %s literal", kind);
        return 0;
    }
floral meteor
night quarryBOT
#

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

001 | 68
002 | Traceback (most recent call last):
003 |   File "<string>", line 20, in <module>
004 |   File "<string>", line 9, in __lshift__
005 |   File "<string>", line 17, in <lambda>
006 |   File "<string>", line 19, in <lambda>
007 | TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
floral meteor
#

wait print isn't a type(lambda:...)

#

why is it giving me NoneType and int sass?

plucky plover
#

print is a builtin_function_or_method

floral meteor
#

which is a different thing

plucky plover
#

we tried this a while back

floral meteor
#

to type(lambda:...) which is function

plucky plover
#

you need to hook lambdas types, builtin function types and one other thing

floral meteor
#

is it somehow evaluating the lshift before the multiplication?

#

nvm i got it

#

im dumb

#

!e ```py
from fishhook import hook

@hook(type(lambda:...))
def rrshift(self, value):
return self(value)

@hook(type(lambda:...))
def lshift(self, value):
return self(value)

@hook(type(lambda:...))
def mul(self, other):
return lambda*a,**k:self(other(*a,**k))

@hook(type(lambda:...))
def rmul(self, other):
return lambda*a,**k:other(self(*a,**k))

f = lambda x:x+1
print * f << 68

night quarryBOT
#

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

69
floral meteor
#

much better syntaxes then print(f(68)) right?

restive void
#

Plus, you can assign print * f to a name

floral meteor
#

!e plus you can chain functions without insanity ```py
from fishhook import hook

@hook(type(lambda:...))
def rrshift(self, value):
return self(value)

@hook(type(lambda:...))
def lshift(self, value):
return self(value)

@hook(type(lambda:...))
def mul(self, other):
return lambda*a,**k:self(other(*a,**k))

@hook(type(lambda:...))
def rmul(self, other):
return lambda*a,**k:other(self(*a,**k))

f = lambda x:x+1
67 >> print * f * f

night quarryBOT
#

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

69
floral meteor
#

!e ```py
def hack(f_n, redirect={}):
from sys import _getframe
frame = _getframe(f_n+1)
def h_inner(f):
redirect.update({f.name:f})
if f.name in frame.f_globals|frame.f_locals:
return frame.f_locals.get(f.name,
frame.f_globals.get(f.name,
frame.f_builtins.get(f.name,None)))
else:
s = frame.f_code.co_code.decode()
CALL_FUNCTION, NOP = '\x83\t'
for i,c in enumerate(s):
if not i%2 and i>=frame.f_lasti and c!=CALL_FUNCTION:
s = s[:i]+NOP+'\0'+s[i+2:]
frame.f_code=frame.f_code.replace(co_code=s.encode()) #!
return None
else: raise NameError(f.name + "could not be cleaned up")
return h_inner

d = {}
@hack(0, d)
def d():
import hello

d'd'
print("test complete")

night quarryBOT
#

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

001 | Hello world!
002 | test complete
floral meteor
#

still working on this one though, it does have some decoding issues when preventing the existence of variables

#

I think this is it

def hack(f_n, redirect={}):
  from sys import _getframe
  frame = _getframe(f_n+1)
  def h_inner(f):
    redirect.update({f.__name__:f})
    if f.__name__ in frame.f_globals|frame.f_locals:
      return frame.f_locals.get(f.__name__,
             frame.f_globals.get(f.__name__,
             frame.f_builtins.get(f.__name__,None)))
    else:
      s = frame.f_code.co_code.decode('ANSI')
      CALL_FUNCTION, NOP = '\x83\t'
      for i,c in enumerate(s):
          if not i%2 and i>=frame.f_lasti and c!=CALL_FUNCTION:
            s = s[:i]+NOP+'\0'+s[i+2:]
            co_code = s.encode('ANSI')
            from ctypes import c_char
            for _,c in zip((c_char*len(co_code)).from_address(id(frame.f_code.co_code)+32),co_code):
              _.value = bytes(c)
            return None
      else: raise NameError(f.__name__ + "could not be cleaned up")
  return h_inner

#test
d = {}
@hack(0, d)
def d():
  import __hello__

@hack(0)
def print(*a):
  try:print(*a)
  except:print(*a)

d['d']()
assert'print'not in globals()
print("test complete")
vague cairn
#

What version of python? because mine c_char*int iterates bytes of length 1, not c_char

modest bough
quartz wave
rustic spruce
#

what is esoteric python?

#

is it like a specific type of code

old socket
#

Stuff about python that isn't common knowledge

rustic spruce
#

oh

thin iris
# rustic spruce what is esoteric python?

It's also doing problems in Python in a way you wouldn't really do. Like trying to write a ray tracer in one line. Or animating an ascii donut, but without loops and it fits on a business card

old socket
#

ctypes, it's always ctypes ๐Ÿ˜”

desert fulcrum
#

isn't ctypes a library in C?

old socket
#

!d ctypes

night quarryBOT
#

ctypes is a foreign function library for Python. It provides C compatible data types, and allows calling functions in DLLs or shared libraries. It can be used to wrap these libraries in pure Python.

quartz wave
#

and it's called a header

restive void
#

Esoteric programming is like doing experimental poetry instead of writing a manual.

wheat river
pastel sparrow
#

more like abuse python internals

floral meteor
#

More like waterboarding python with its own internals.

#

actually ouch that sounds brutal

#

luckily everyone here has already traumatised themselves with their own code.

#

This channel is called esoteric-python instead of just esoteric, because you need to be constantly reminded that the code here is still python code.

pastel sparrow
#

kekw

#

i sent my hello world code to my friend once and the first thing he said was "brainfuck?"

desert fulcrum
languid hare
#

!e

(c:=int),(b:=range),(P:=print),((C:=__import__('math')),),(A:=lambda A,B:((E:=C.cos(A)),(F:=C.sin(A)),(J:=C.cos(B)),(K:=C.sin(B)),(Q:=[]),(R:=[]),all((((Q.append([' ']*(D+0)),R.append([0]*(D+0))),)for d in b(O+1))),(G:=0),next((_ for _ in iter(int,1)if((False,(G:=G+f),(L:=C.cos(G)),(S:=C.sin(G)),(H:=0),next((_ for _ in iter(int,1)if((False,(H:=H+g),(T:=C.cos(H)),(I:=C.sin(H)),(U:=Y+N*L),(V:=N*S),(h:=U*(J*T+F*K*I)-V*E*K),(i:=U*(K*T-F*J*I)+V*E*J),(j:=Z+E*U*I+V*F),(M:=1/j),(W:=c(D/2+a*M*h)),(X:=c(O/2-a*M*i)),(e:=T*L*K-E*L*I-F*S+J*(E*S-L*F*I)),((R[W].__setitem__(X,M),(k:=e*8),Q[W].__setitem__(X,'.,-~:;=!*#$@'[c(k)]))if M>R[W][X]else None)if e>0 else None)[0]if H<2*C.pi else True))))[0]if G<2*C.pi else True))),P('\x1b[H'),all((((all(((P(Q[d][l],end=''),)for l in b(D))),P()),)for d in b(O))),None)[-1]),(f:=0.07),(g:=0.02),(N:=1),(Y:=2),(Z:=5),(D:=40),(O:=40),(a:=D*Z*3/(8*(N+Y))),P('\x1b[2J'),A(1,0)
night quarryBOT
#

@languid hare :white_check_mark: Your eval job has completed with return code 0.

001 | 
002 | 
003 |                                         
004 |                                         
005 |                                         
006 |             ==;;:::~-                   
007 |           !!==;;::~~~--                 
008 |         *!!!=;;::~~~~---,               
009 |        **!!==;::~~~~-----,              
010 |       #*!!=;;::~~--------,.             
011 |      #**!!=;;:~~---,------,.            
... (truncated - too many lines)

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

languid hare
#

tragic

#

!e

(c:=int),(b:=range),(P:=print),((C:=__import__('math')),),(A:=lambda A,B:((E:=C.cos(A)),(F:=C.sin(A)),(J:=C.cos(B)),(K:=C.sin(B)),(Q:=[]),(R:=[]),all((((Q.append([' ']*(D+0)),R.append([0]*(D+0))),)for d in b(O+1))),(G:=0),next((_ for _ in iter(int,1)if((False,(G:=G+f),(L:=C.cos(G)),(S:=C.sin(G)),(H:=0),next((_ for _ in iter(int,1)if((False,(H:=H+g),(T:=C.cos(H)),(I:=C.sin(H)),(U:=Y+N*L),(V:=N*S),(h:=U*(J*T+F*K*I)-V*E*K),(i:=U*(K*T-F*J*I)+V*E*J),(j:=Z+E*U*I+V*F),(M:=1/j),(W:=c(D/2+a*M*h)),(X:=c(O/2-a*M*i)),(e:=T*L*K-E*L*I-F*S+J*(E*S-L*F*I)),((R[W].__setitem__(X,M),(k:=e*8),Q[W].__setitem__(X,'.,-~:;=!*#$@'[c(k)]))if M>R[W][X]else None)if e>0 else None)[0]if H<2*C.pi else True))))[0]if G<2*C.pi else True))),P('\x1b[H'),all((((all(((P(Q[d][l],end=''),)for l in b(D))),P()),)for d in b(O))),None)[-1]),(f:=0.07),(g:=0.02),(N:=1),(Y:=2),(Z:=5),(D:=10),(O:=10),(a:=D*Z*3/(8*(N+Y))),P('\x1b[2J'),A(1,0)
night quarryBOT
#

@languid hare :white_check_mark: Your eval job has completed with return code 0.

001 | 
002 | 
003 |    =:-    
004 |  *!;~--   
005 | $!=~----  
006 | #!;-..~~  
007 | #!;. !!=  
008 | #!;, !!=  
009 | #*;-..~~  
010 | $!=~----  
011 |  *!;~--   
... (truncated - too many lines)

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

languid hare
#

tiny donut

pastel sparrow
#

damn

#

iirc someone first did that in c++ right?

#

and the code was in the shape of a donut too

languid hare
#

yup

versed eagle
cloud crest
#

Prints errors in ACSII Codes

cloud crest
#

!e print([1]*10)

night quarryBOT
#

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

[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
cloud crest
#

!e print([2]*10)

night quarryBOT
#

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

[2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
cloud crest
#

!e print([0]*10+2)

night quarryBOT
#

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

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | TypeError: can only concatenate list (not "int") to list
cloud crest
#

!e print([0]*10) + 2

night quarryBOT
#

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

001 | [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
002 | Traceback (most recent call last):
003 |   File "<string>", line 1, in <module>
004 | TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
cloud crest
#

!e print([x=2*x]*10)

night quarryBOT
#

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

001 |   File "<string>", line 1
002 |     print([x=2*x]*10)
003 |            ^^^^^
004 | SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
cloud crest
#

!e ```python
x = 264
print([x
2]*10)

night quarryBOT
#

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

[256, 256, 256, 256, 256, 256, 256, 256, 256, 256]
night quarryBOT
#

6. Do not post unapproved advertising.

royal whale
#

Also

#

!rule 7

night quarryBOT
#

7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.

royal whale
#

ok

#

someone deleted them
Nevermind

bold root
#

ok guys

#

first 32 of the fib seq in only 36 characters or less

#
0
1
1
2
3
5
8
13
21
34
55
89
144
233
377
610
987
1597
2584
4181
6765
10946
17711
28657
46368
75025
121393
196418
317811
514229
832040
#

this should be the output

golden finch
#
a=0;b=1;exec('a,b=b,a+b;print(b);'*32)

this might be a way to start but I can't figure out how to create the first 2

#

and it's 38, already

bold root
#

interesting

#

right now we got this

def f(i,j):print(i);f(j,i+j)
f(1,1)
#

@golden finch

#

but its not limited to 32

golden finch
#

neat

grave cedar
#

in case anyone missed in pygen, I did 40:

a,b=0,1
while a<2**20:print(a);a,b=a+b,a
quartz wave
#

it's not a simple statement

grave cedar
grave cedar
royal whale
#

!e```py
x = 10
while x > 0: print(x); x -= 1

night quarryBOT
#

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

001 | 10
002 | 9
003 | 8
004 | 7
005 | 6
006 | 5
007 | 4
008 | 3
009 | 2
010 | 1
grave cedar
royal whale
#

Ohh

#

Ok

quartz wave
grave cedar
grave cedar
grave cedar
bold root
#

!e
a=0;b=1;exec(โ€˜print(a);a,b=a+b,a;โ€™*31)

night quarryBOT
#

@bold root :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     a=0;b=1;exec(โ€˜print(a);a,b=a+b,a;โ€™*31)
003 |                  ^
004 | SyntaxError: invalid character 'โ€˜' (U+2018)
bold root
#

Damn

#

Ehat did i do weong here

grave cedar
quartz wave
bold root
#

!e
a=0;b=1;exec(โ€œprint(a);a,b=a+b,a;โ€*31)

night quarryBOT
#

@bold root :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     a=0;b=1;exec(โ€œprint(a);a,b=a+b,a;โ€*31)
003 |                  ^
004 | SyntaxError: invalid character 'โ€œ' (U+201C)
quartz wave
#

this feels like it comes from code.golf

bold root
#

Im clnfused

bold root
quartz wave
#

hmm

bold root
#

Im doing this on my phone btw

#

print(a);a,b=a+b,a;

quartz wave
#

what if we use the golden ratio

bold root
#

!e
a=0;b=1;exec('print(a);a,b=a+b,a;'*32)

night quarryBOT
bold root
#

Pog

grave cedar
# quartz wave what if we use the golden ratio

yeah I tried that earlier, could not make anything short enough.
probably a way to shorten this:

for i in range(31):print(round((.5+5**.5/2)**i/5**.5))

but that passes their test case

vestal solstice
#

hint ||a=b=...||

quartz wave
vestal solstice
#

i know

#

i'm not theorising, i have 36

quartz wave
#

ok

quartz wave
#

yeah idk

golden finch
mortal pendant
#

can someone help me to solve this problem ?

grave cedar
# vestal solstice i'm not theorising, i have 36

I'd thought of that, but everything I can try around a=b=(some value) seems to fail so far.
it seems like there must be some esoteric magic here. The exec was a nice touch.
Is your solution still valid on their site? (ie: have they changed he version of their python and it's no longer possible)

grave cedar
floral meteor
#

!e ```py
hs=lambda n,fe,fo:[(n:=[fe,fo]n%2)for _ in iter(lambda:n<2,1)]
print(hs(69,lambda x:x//2-1,lambda x:x2))

night quarryBOT
#

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

138 68 33 66 32 15 30 14 6 2 0
floral meteor
#

Ugh I'm not doing this right

grave cedar
#

sharing this reverse fib solution that works, even though it's 57 long.

f=lambda a=514229,b=832040:b>0and f(b-a,a)or print(b);f()

maybe there's an idea there.

floral meteor
#

!e ```py
hs=lambda n:(a:=[n],{a.append((n:=[n//2,n*3+1][n%2]))for _ in iter(lambda:a.count(n),2)}and[0,0])[not n][:-1]
print(*hs(69))
print(*hs(71))

night quarryBOT
#

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

001 | 69 208 104 52 26 13 40 20 10 5 16 8 4 2 1
002 | 71 214 107 322 161 484 242 121 364 182 91 274 137 412 206 103 310 155 466 233 700 350 175 526 263 790 395 1186 593 1780 890 445 1336 668 334 167 502 251 754 377 1132 566 283 850 425 1276 638 319 958 479 1438 719 2158 1079 3238 1619 4858 2429 7288 3644 1822 911 2734 1367 4102 2051 6154 3077 9232 4616 2308 1154 577 1732 866 433 1300 650 325 976 488 244 122 61 184 92 46 23 70 35 106 53 160 80 40 20 10 5 16 8 4 2 1
floral meteor
#

hailstone sequence!

#

71 generates a large sequence

#

!e graffs ```py
hs=lambda n:(a:=[n],{a.append((n:=[n//2,n3+1][n%2]))for _ in iter(lambda:a.count(n),2)}and[0,0])[not n][:-1]
T = lambda s:'\n'.join(''.join(_)for _ in zip(
(lambda a:[f"{_: >{max(map(len,a))}s}"for _ in a])(s.split('\n'))))
S = T('\n'.join(['*'*n for n in map(len,map(hs,range(69)))]))
print(S)

night quarryBOT
#

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

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

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

floral meteor
#

Here you can see a graph of y = hailstone_sequence(x)
The area under the curve is the number of asterisks in the graph.

sick hound
#
import math,random;y=lambda n,l:[[n]if n<=l else[l if(n-(l*math.floor(n/l)))==0 else (n-(l*math.floor(n/l)))for x in[1]]for x in[1]][0][0];z=lambda p,a:[chr(random.Random(ord(c)*678).randint(457,875))for c in list((p*a)[:a])]
def e(d,c):a=[];b=z(c,7);[a.append(chr(ord(list(d)[_])+ord(c[y(_+1,len(c))-1])+ord(c[::-1][0])))for _ in range(len(d))];a=list(''.join('%s%s'%(x,random.choice(b)if random.random()>0.5 else'')for x in''.join(a)));e=[];f=[];g=list('ghijklmno');h=list('pqrstuv');[e.append(str(hex(ord(j))).split('0x')[1])for j in a];[f.append(i+random.choice(g))for i in e];f=''.join(f)[:-1];return f.upper()[::-1]+random.choice(h).upper()+str(random.randint(137,975))
def d(a,b):c=a.split(a[-4:][:1])[0];c=c.lower()[::-1];d=[];e=[];f=z(b, 7);g=[];h=[];c=c.replace('g','#');c=c.replace('h','#');c=c.replace('i','#');c=c.replace('j','#');c=c.replace('k','#');c=c.replace('l','#');c=c.replace('m','#');c=c.replace('n','#');c=c.replace('o','#');d=c.split('#');[e.append(chr(eval('0x'+i)))for i in d];[g.append(j)if j not in f else j for j in e];[h.append(chr(ord(list(g)[_])-ord(b[y(_+1, len(b))-1])-ord(b[::-1][0])))for _ in range(len(g))];return ''.join(h)

encrypted = e('https://github.com/3xq', 'komt#0005')
decrypted = d(encrypted, 'komt#0005')

print(encrypted)
print(decrypted)```

Just Another Python Hacker :^)
#

3 lines, excluding the 6 at the bottom

#

Oh by the way, every time you encrypt it, it outputs something different every time but decrypts to the same thing. :P

#

Output from running it 5 times:

303NA11KFE1IA11N7DJFCO4D1G7DJ4DM463G8CL39MABJ463GE11O4D1IA01I811NFE1M901I463K1DO4D1O49J49HF9MBCL911O4D1H611O4D1N811JB02K801R743
8D2JA11O303NA11N7DK4D1JFCI7DG4DO8D2N8CH39N4D1HABLE11NB02MA01N4D1N811G901NB02M1DI49H8D2H49I463LF9I303IBCKFE1L911M611H303K811L801S451
A11JA11LFE1O7DI303GFCM8D2K7DJ4DJ8CN463M39IABK303JE11IA01O811N901M1DI49O49OF9JBCN911M463K611J811J801R523
A11MA11H4D1L7DGFCL4D1H7DM4DN8CJ39OFE1NABLFE1KE11GA01GB02M811H901H1DN8D2M49LFE1K49L463KF9LBCJ8D2G911G463H611O8D2K811O801T761
A11LA11I7DJFCN8D2H7DNB02N4DL8CI303O39NABH303GE11O8D2MA01L303O811J463K901J1DM49N49GF9MBCI303G911I8D2J611K811OB02G801V720```
floral meteor
#

last time i encrypted, there was a brainfuck interpreter built into the decryption process, but it interpreted digits in a massive integer built by indexing digits from a ridiculously supermassive integer built from two keys.
If you were good with brainfuck, you could make a message interactive, due to being turing complete.

#

it sounds great but really it was one big hilarious mess

quartz wave
quartz wave
#
c[::-1][0]
``` this makes me feel annoyed