#esoteric-python

1 messages ยท Page 34 of 1

floral meteor
#

lol

sick hound
#
map(int,*input()[::2])```
something like this
floral meteor
#

!e ```py
print(*map(int,"2 2"[::2]))

night quarryBOT
#

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

2 2
floral meteor
#

sure it works

floral meteor
sick hound
#

oh yeahh

#

hahaha

sick hound
#

oh shit just works for numbers with one digit
something like "10 5" wouldnt work" XD

floral meteor
#

duh lol

floral meteor
#

that would be back to partition

gleaming linden
#

it takes a callable and iterable

#

literal int is callable and list[str] (from str.split()) is iterable

sick hound
#

new info

#

thanks

low lynx
#

int the type is callable

#

instances of int aren't

sick hound
#

isnt int a class

low lynx
#

yeah

#

it's also a type

gleaming linden
#

you can call int like int("2"), so it's a callable

sick hound
#

thanks guys :p

magic wraith
#

congrats guys

#

I'm surprised they chose mine for the tallest house of cards

magic wraith
#

!e py print(list[str].append("123"))

night quarryBOT
#

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

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 1, in <module>
003 |     print(list[str].append("123"))
004 |           ^^^^^^^^^^^^^^^^^^^^^^^
005 | TypeError: descriptor 'append' for 'list' objects doesn't apply to a 'str' object
blissful oar
#

How does this bot interpret code?

#

I feel like it could be exploitable by running malicious code or libraries

mossy plume
night quarryBOT
#
Command Help

!eval [python_version] <code, ...>
Can also use: e

Run Python code and get the results.

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

The starting working directory /home, is a writeable temporary file system. Files created, excluding names with leading underscores, will be uploaded in the response.

If multiple codeblocks are in a message, all of them will be joined and evaluated, ignoring the text outside them.

Currently only 3.11 version is supported.

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

blissful oar
#

I know it's eval but surely anything that can run code could theoretically be exploited

#

Because a system still has to take the input

mossy plume
blissful oar
#

Is it allowed to try

#

Sounds fun

mossy plume
mossy plume
arctic skiff
#
[*map(int,[*str(int(''.join(map(str,digits)))+1)])]```
clear venture
#

Strings are iterable

arctic skiff
#

didn't think of that

#
[*map(int,str(int(''.join(map(str,digits)))+1))]```
#

-3 chars

gleaming linden
#

The link doesn't load for me

gleaming linden
#

Is it adding 1 to a number as a list of digits?

quartz wave
#

i think

arctic skiff
#

ohh wait yeah it won't load because it's submissions

#

not solution

quartz wave
#

loads for me

#

if i'm signed in, that is

arctic skiff
quartz wave
gleaming linden
#

int(str(digits)[1::3]) instead of ''.join?

arctic skiff
#

hmmm

versed eagle
#

str.join should be fairly fast

gleaming linden
#

probably not

#

but it's shorter

#
[*map(int,str(int(str(digits)[1::3])+1))]
[*map(int,str(int(''.join(map(str,digits)))+1))]
versed eagle
#

oh true

arctic skiff
#

!tipy [*map(int,str(int(''.join(map(str,[1,2,3])))+1))]

night quarryBOT
#

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

200000 loops, best of 5: 1.57 usec per loop
arctic skiff
#

!ti```py
[*map(int,str(int(str([1,2,3])[1::3])+1))]

night quarryBOT
#

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

200000 loops, best of 5: 1.34 usec per loop
arctic skiff
#

@versed eagle

distant salmon
#

Btw if you actually care about speed then you should just add 1 to index 0 and then handle the "overflow" with a loop.

#

That will basically be instant unless the number ends with 999...

fleet bridge
distant salmon
night quarryBOT
#

@distant salmon :white_check_mark: Your 3.11 timeit job has completed with return code 0.

1000000 loops, best of 5: 218 nsec per loop
distant salmon
#

I wouldnt be so sure about that

rugged sparrow
#

!e ```py
def addOne(d):
d[-1]+=1
if d[-1]==10:
return addOne(d[:-1])+[0]
return d
print(addOne(list(range(5))))

night quarryBOT
#

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

[0, 1, 2, 3, 5]
dreamy pier
#

It dies if all the digits are 9

distant salmon
night quarryBOT
#

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

001 | [1, 2, 3, 4, 6]
002 | [1, 0, 0, 0]
orchid nymph
#

!ti

def addOne(d: list[int]) -> list[int]:
  for i in range(len(d)-1,-1,-1):
    if d[i] < 9:
      d[i] += 1
      break
    d[i] = 0
  else:
    d.insert(0, 1)
  return d
print(addOne([9,9,9]))
night quarryBOT
#

@orchid nymph :white_check_mark: Your 3.11 timeit job has completed with return code 0.

100000 loops, best of 5: 2.32 usec per loop
orchid nymph
#

!ti

def addOne(d):
  for i in range(len(d)-1,-1,-1):
    if d[i] < 9:
      d[i] += 1
      break
    d[i] = 0
  else:
    d.insert(0, 1)
  return d

addOne([1,2,3])
night quarryBOT
#

@orchid nymph :white_check_mark: Your 3.11 timeit job has completed with return code 0.

500000 loops, best of 5: 592 nsec per loop
orchid nymph
#

!ti

d=[1,2,3]
for i in range(len(d)-1,-1,-1):
  if d[i] < 9:
    d[i] += 1
    break
  d[i] = 0
else:
  d.insert(0, 1)
night quarryBOT
#

@orchid nymph :white_check_mark: Your 3.11 timeit job has completed with return code 0.

500000 loops, best of 5: 423 nsec per loop
orchid nymph
#

!ti

d=[9,9,9]
for i in range(len(d)-1,-1,-1):
  if d[i] < 9:
    d[i] += 1
    break
  d[i] = 0
else:
  d.insert(0, 1)
night quarryBOT
#

@orchid nymph :white_check_mark: Your 3.11 timeit job has completed with return code 0.

500000 loops, best of 5: 591 nsec per loop
distant salmon
night quarryBOT
#

@distant salmon :white_check_mark: Your 3.11 timeit job has completed with return code 0.

500000 loops, best of 5: 755 nsec per loop
orchid nymph
#

ow yeah I forgot that range slicing is very fast because it returns a range

distant salmon
#

Another nice feature of ranges is that they support len

#

So you don't have to try to come up with a math formula

fleet bridge
#

!e range(1,10)[3]

night quarryBOT
#

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

[No output]
fleet bridge
#

ranges works like lists of integers that satisfies some constraints
therefore ranges supports all list "readonly" operation, because these operations cannot break the constraints

#

!e print(range.dict.keys())

night quarryBOT
#

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

dict_keys(['__new__', '__repr__', '__hash__', '__getattribute__', '__lt__', '__le__', '__eq__', '__ne__', '__gt__', '__ge__', '__iter__', '__bool__', '__len__', '__getitem__', '__contains__', '__reversed__', '__reduce__', 'count', 'index', 'start', 'stop', 'step', '__doc__'])
stark granite
#

!e
del import('sys').modules['builtins']
print("it shouldnt work...")

night quarryBOT
#

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

it shouldnt work...
stark granite
#

???

rugged sparrow
#

Builtins will be repopulated in some cases

stark granite
#

it should throw RuntimeError tho

#

hm

#

!e
import sys
for module in sys.modules.copy():
del sys.modules[module]
print("test")

night quarryBOT
#

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

test
stark granite
#

???

#

I suppose it throws runtimeerror only in repl...

fleet bridge
#

repl relies on a lot of random stuff, no wonder it throws

orchid nymph
#

!e

del __builtins__.__import__
import sys
night quarryBOT
#

@orchid nymph :x: Your 3.11 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 2, in <module>
003 | ImportError: __import__ not found
orchid nymph
#

!e

__builtins__.__import__ = lambda n,*_: n
import lol
print(lol)
night quarryBOT
#

@orchid nymph :white_check_mark: Your 3.11 eval job has completed with return code 0.

lol
ivory niche
#

Yo yall

#

How can I make certain code execute every time my program errors, (raises an unhandled exception)

rugged sparrow
#

!d sys.excepthook

night quarryBOT
#

sys.excepthook(type, value, traceback)```
This function prints out a given traceback and exception to `sys.stderr`.

When an exception other than [`SystemExit`](https://docs.python.org/3/library/exceptions.html#SystemExit) is raised and uncaught, the interpreter calls `sys.excepthook` with three arguments, the exception class, exception instance, and a traceback object. In an interactive session this happens just before control is returned to the prompt; in a Python program this happens just before the program exits. The handling of such top-level exceptions can be customized by assigning another three-argument function to `sys.excepthook`.
stark granite
#

!e
builtins.import = lambda *stuff: print(stuff)
import lol
print(lol)

ivory niche
stark granite
#

!e
builtins.import = lambda *stuff: print(stuff, [type(thing) for thing in stuff])
import lol
print(lol)

night quarryBOT
#

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

001 | ('lol', {'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': <_frozen_importlib_external.SourceFileLoader object at 0x7f8e44350d50>, '__spec__': None, '__annotations__': {}, '__builtins__': <module 'builtins' (built-in)>, '__file__': '/home/main.py', '__cached__': None}, {'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': <_frozen_importlib_external.SourceFileLoader object at 0x7f8e44350d50>, '__spec__': None, '__annotations__': {}, '__builtins__': <module 'builtins' (built-in)>, '__file__': '/home/main.py', '__cached__': None}, None, 0)
002 | None
orchid nymph
#

!e

exec(bytes(ord(c)%i+32 for c in'๒…”•๒”ญ›๐”š›๐™ชฃ๑‚ญƒ๒€Œ๒€บ๓˜”“๒žฏฅ๑ป–๑Œ‚ผ๒คญ๓ฑ–›๓ˆธ๓ฑ๒‚ซจ็งต๒พถข๓ถ““๐ฐ‘ญ๑ฌŽˆ๓ญผ”๒žฏฅ๑ป–๐ฟ–๒คญ๒Œงฑ๓ŠŽ•๐ป’๑ธฃ๐บธฒ๐ฃ†ด๓œฟŒ๒ญฝผ๓’ณ™๒ตฅจ๓‹‹ฐ๒ฝ”๓ƒค‡๐žŠ๓ฉช”๑ฎชท๒”กˆ๓“žŠ๓น–‚๒ฃคฟ๓น‚ฎ๐™ฆ†๑šพ๑ค˜†๐ฎฟš๑ถ…“๐ซขพ๓‚†ฑ๒ก…ๅŸป๐กˆฑ๐ฎ…ก๒–ฐ๐—Žฆ๒ทถ‰๒‘ฟฐ๓‹‘ฒโšŽ๓‹‘ฒ๒—‰ช๑ณขช๓พ„ ๑ตช‘้ฝƒ็ซผ๊Œต๓’พ๐ฃ Š๒›ธก๒Œน…์‘š๒ฆด๐‘ฌญๅ€Ÿ๑ฎฃธไฅ‚๒ขงš๓ข‹ณ๓กฌ’๒Š“ถ๑šฆฟ๓—ฏ๐–ฅŽ๑€ทฎ๓†‡ธ๒ฆด๐‘ฌญ๐–ฒ”๑ธฃŸ๑ถซ'for i in b'efg'))
import five.nine.minus.one.three as result
print(result)
night quarryBOT
#

@orchid nymph :white_check_mark: Your 3.11 eval job has completed with return code 0.

46
stark granite
#

!e
builtins.import = lambda *stuff: print(stuff, [type(thing) for thing in stuff])
import lol
print(lol)

night quarryBOT
#

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

001 | ('lol', {'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': <_frozen_importlib_external.SourceFileLoader object at 0x7fab0a5bccd0>, '__spec__': None, '__annotations__': {}, '__builtins__': <module 'builtins' (built-in)>, '__file__': '/home/main.py', '__cached__': None}, {'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': <_frozen_importlib_external.SourceFileLoader object at 0x7fab0a5bccd0>, '__spec__': None, '__annotations__': {}, '__builtins__': <module 'builtins' (built-in)>, '__file__': '/home/main.py', '__cached__': None}, None, 0) [<class 'str'>, <class 'dict'>, <class 'dict'>, <class 'NoneType'>, <class 'int'>]
002 | None
orchid nymph
#

!e

def func(name: str, *_):
    class C(int):
        def __getattr__(self,n):
            return self
        
    return C(eval("".join(
        {
            "zero": "0",
            "one": "1",
            "two": "2",
            "three": "3",
            "four": "4",
            "five": "5",
            "six": "6",
            "seven": "7",
            "eight": "8",
            "nine": "9",
            "plus": "+",
            "minus": "-",
            "multipled_by": "*",
            "divided_by": "//",
            "modulo": "%",
            "power": "**",
        }.get(part.lower(),"?")
            for part in name.split(".")
    )))

__builtins__.__import__ = func

import one.plus.one

print(one.plus.one)
#

there you go, semi readable version

stark granite
#

thanks

night quarryBOT
#

@orchid nymph :white_check_mark: Your 3.11 eval job has completed with return code 0.

2
rugged sparrow
formal latch
#

seems like it's converting one.plus.one -> ["one", "plus", "one"] -> "1+1" and evaling it to return 2

#

and 4@ is just overriding import so it uses their own class for this

#

!e

def hijack_import(name, *_):
  print(f"We are hijacking the import of {name}")

  return 1

# Make `import test` run `hijack_import(test)` instead of default behavior
__builtins__.__import__ = hijack_import

import test

print(test)
night quarryBOT
#

@formal latch :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | We are hijacking the import of test
002 | 1
magic wraith
#

!e ```py
B = builtins
B.import, B.print = B.print, B.import

print('math')
import math.sqrt```

night quarryBOT
#

@magic wraith :white_check_mark: Your 3.11 eval job has completed with return code 0.

math.sqrt {'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': <_frozen_importlib_external.SourceFileLoader object at 0x7f4604820d50>, '__spec__': None, '__annotations__': {}, '__builtins__': <module 'builtins' (built-in)>, '__file__': '/home/main.py', '__cached__': None, 'B': <module 'builtins' (built-in)>} {'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': <_frozen_importlib_external.SourceFileLoader object at 0x7f4604820d50>, '__spec__': None, '__annotations__': {}, '__builtins__': <module 'builtins' (built-in)>, '__file__': '/home/main.py', '__cached__': None, 'B': <module 'builtins' (built-in)>} None 0
sick hound
#

!e py print("".join([chr(getattr(__builtins__,"".join([chr(_)for(_)in[108,101,110]]))(_))for(_)in"โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹".split()])) how can i make this better

night quarryBOT
#

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

Hello World!
sick hound
red raptor
#

this looks wierd coding

#

looks like wierd coding sorry

versed eagle
#

confusing is subjective

sick hound
versed eagle
#

no

#

i dont

#

if i knew what you meant i would respond to that

quartz wave
#

not really

sick hound
#

bruh

unique heath
night quarryBOT
#

@unique heath :warning: Your 3.11 eval job has completed with return code 0.

[No output]
unique heath
ashen adder
# sick hound !e ```py print("".join([chr(getattr(__builtins__,"".join([chr(_)for(_)in[108,101...

!e py print("".join([chr(getattr(__builtins__,"".join(map(chr,[108,101,110])))(_))for(_)in"โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹".split()]))

night quarryBOT
#

@ashen adder :white_check_mark: Your 3.11 eval job has completed with return code 0.

Hello World!
fleet bridge
#

!e ```py
print('a')

night quarryBOT
#

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

b
fleet bridge
#

you are calling len with one empty string, then chr'ing it and joining

#

where hello world came from

versed eagle
#

the empty string isn't empty would be my guess

fleet bridge
#

.split will return [""] in that case

versed eagle
#

its full of unicode trickery

fleet bridge
#

except there are some whitespace-looking non-whitespace chars

versed eagle
#

i checked

fleet bridge
#

!charinfo " "

night quarryBOT
#
Character Info

\u0022 : QUOTATION MARK - "
\u0020 : SPACE -
\u0020 : SPACE -
\u0020 : SPACE -
\u0020 : SPACE -
\u0020 : SPACE -
\u0020 : SPACE -
\u0020 : SPACE -
\u0020 : SPACE -
\u0020 : SPACE -

Full Raw Text

\u0022\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0022

versed eagle
#

its 1096 characters in total

fleet bridge
#

my discord client copied it incorrectly

versed eagle
#

there's a ton of invisible characters in it

#

!e ```py
print(len("โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹ โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹"))

#

... i forgot a parentheses :c

night quarryBOT
#

@versed eagle :white_check_mark: Your 3.11 eval job has completed with return code 0.

1096
versed eagle
#

but yeah there's unicode trickery going on here

unique heath
#

"short" :P

versed eagle
# magic wraith !e ```py B = __builtins__ B.__import__, B.print = B.print, B.__import__ print('...

!e ```py
from ctypes import c_void_p as v
def sf(a, b, o__={}):
md = v.from_address(id(a) + 16)
vc = v.from_address(id(a) + 48)
if id(a) not in o__:
o__[id(a)] = (md.value, vc.value)
if id(b) in o__:
nmd, nvc = o__[id(b)]
else:
nmd = v.from_address(id(b) + 16).value
nvc = v.from_address(id(b) + 48).value
md.value, vc.value = nmd, nvc
def sw(a, b):
sf(a, b); sf(b, a)
sw(import, print)

import(f"{print('math') = }")

night quarryBOT
#

@versed eagle :white_check_mark: Your 3.11 eval job has completed with return code 0.

print('math') = <module 'math' from '/lang/python/default/lib/python3.11/lib-dynload/math.cpython-311-x86_64-linux-gnu.so'>
versed eagle
#

a more interesting way to switch the functions

magic wraith
#

can it be used with import keyword tho?

unique heath
#

import just uses __builtins__.__import__

versed eagle
#

why wouldn't it be able to?

arctic skiff
# magic wraith can it be used with `import` keyword tho?

!e ```py
from ctypes import c_void_p as v
def sf(a, b, o__={}):
md = v.from_address(id(a) + 16)
vc = v.from_address(id(a) + 48)
if id(a) not in o__:
o__[id(a)] = (md.value, vc.value)
if id(b) in o__:
nmd, nvc = o__[id(b)]
else:
nmd = v.from_address(id(b) + 16).value
nvc = v.from_address(id(b) + 48).value
md.value, vc.value = nmd, nvc
def sw(a, b):
sf(a, b); sf(b, a)
sw(import, print)

import hello
import(hello)

night quarryBOT
#

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

<module '__hello__' (frozen)>
arctic skiff
#

no

serene stratus
#
def multiply_matrices(x, y):
    u,l=list,len
    o,p,r=u(set([l(r)for r in x])),u(set([l(r)for r in y])),range
    return[[sum([prod((x[k][i],y[i][j]))for i in r(o[0])])for j in r(p[0])]for k in r(l(x))]if not((l(o),l(p))!=(1,1)or o[0]!=l(y)or p[0]!=l(x))else None```
#

my attempt at golfing matrices multiplication

#

assume the function prod exists

#

what can we do to further golf it

#

I mean there is probably some math shit you can do

#

but I am talking python wise

restive void
#

Replace set([...]) with {...}

serene stratus
#

smart

proper vault
#

The sum doesn't need ([, can just be (

restive void
#

You can probably rewrite the last line to not return None explicitly

polar nimbus
#

Is your goal to make it as unreadable as possible

restive void
#

It's golfing, so the goal is to make it as short as possible.

gleaming linden
#

I was gonna golf it even more but my keyboard broke ๐Ÿ˜ฉ

gleaming linden
# serene stratus what can we do to further golf it
  • avoid range if possible
    • zip(*y) is basically y^T
    • a and b are the vectors to dot product
    • you could also do map(prod,zip(a,b)) instead of sum(i*j for i,j in zip(a,b)) assuming it's defined ofc
  • set([l(r)for r in x]) -> {*map(l,x)}
  • x if cond else y -> (y,x)[cond]
  • lambda
l=len
multiply_matricies=lambda x,y:(None,[[sum(i*j for i,j in zip(a,b))for a in x]for b in zip(*y)])[1==l({*map(l,x)})==l({*map(l,y)})and l(x[0])==l(y)and l(y[0])==l(x)]
serene garnet
#

can you golf this code for me?

n,m=map(int,input().split())
print('a'*(n-m),*map(chr,range(97,97+m)),sep='')
gleaming linden
#

what does it do?

serene garnet
#

um..

gleaming linden
#

!e ```py
n,m=5,10
print('a'*(n-m),*map(chr,range(97,97+m)),sep='')

night quarryBOT
#

@gleaming linden :white_check_mark: Your 3.11 eval job has completed with return code 0.

abcdefghij
serene garnet
#

just translated it bloblul

gleaming linden
#

and the optimal method is to spam A's at the start?

#

!e ```py
n,m=10,5
print('a'*(n-m),*map(chr,range(97,97+m)),sep='')

night quarryBOT
#

@gleaming linden :white_check_mark: Your 3.11 eval job has completed with return code 0.

aaaaaabcde
craggy hamlet
#

without golfing any names

orchid nymph
#

!e

n,m=10,5
print('a'*(n-m)+bytes(range(97,97+m)).decode())
night quarryBOT
#

@orchid nymph :white_check_mark: Your 3.11 eval job has completed with return code 0.

aaaaaabcde
serene stratus
orchid nymph
#

!e

n,m=10,5
while n:print(end=chr(97-min(0,n-m)));n-=1
night quarryBOT
#

@orchid nymph :white_check_mark: Your 3.11 eval job has completed with return code 0.

aaaaaabcde
craggy hamlet
#

it does not

cloud fossil
#

Does anyone have a solution from other mindsets of programming?
The exercise requires writing a function that takes 7 or 8 and prints 8 or 7 respectively.

def f(x):
    print(7 if x == 8 else 8)
def f(x):
    print([8, 7][x - 7])
def f(x):
    print(15 - x)
def f(x):
    print(x ^ 15)
clear venture
#

ig the first does too

#

nvm

cloud fossil
#

The assumption is that it takes either 7 or 8

#

And if it was a low level language, one byte (sign doesn't matter in this case I guess)

clear venture
#
>>> def f(x): print(chr(63 - x))
>>> f(7)
8
>>> f(8)
7
versed eagle
clear venture
#

well yeah

#

I mean there aren't gonna be any better solutions

#

but it's a different path of getting to the same result

#
>>> def f(x): print(x - 7 and 7 or 8)
... 
>>> f(8)
7
>>> f(7)
8
versed eagle
clear venture
#

ok

#
>>> def f(x): print(dict(zip(v:=[7,8],v[::-1]))[x])
... 
>>> f(7)
8
>>> f(8)
7
fleet bridge
#

v[v[::-1].index(x)] also should work

#

i like the most x^15 thing

distant salmon
#

codegolf is always the best answer

distant salmon
#

The dict solutions also work for floating point input

fleet bridge
#

15-x works for ints and floats, and for numbers other than 7 or 8, and can easily be done for other number pairs

i like x^15 more because it uses some special property of 7 and 8

#

btw x=1-x is often done to swap 0 and 1

distant salmon
#

The subtraction trick works much more in general, to swap any numbers a and b, you can just do

(a + b) - x
#

Thats why I like it

clear venture
#
>>> def f(x): print(sum([7,8],start=-x))
... 
>>> f(7)
8
>>> f(8)
7
unique heath
#

i dont understand it

fleet bridge
#

7+[7,8].index(x)
7+[8,7].index(x)

fleet bridge
distant salmon
fleet bridge
#

no?

#

oh, yes

unique heath
#

you guys swapping 8 and 7?

fleet bridge
distant salmon
unique heath
#

i feel like

#

there's some sort of bit flip

clear venture
#
>>> def f(x): print(-(x >> 3) + 8)
... 
>>> f(8)
7
>>> f(7)
8
clear venture
distant salmon
#
>>> def f(x): print(7+x%2)
... 
>>> f(8)
7
>>> f(7)
8
clear venture
#

brain interpreter self-checking mode

#

based mod 2

fleet bridge
#

x+ord(str(x))%4//3
please check that, my brain's interpreter is not good enough today

fleet bridge
clear venture
#
>>> def f(x): print(x+ord(str(x))%4//3)
... 
>>> f(7)
8
>>> f(8)
8
fleet bridge
#

aaa

distant salmon
clear venture
#

think 4//3 goes off before mod

distant salmon
#

It doesn't

#

Mod, multiplication and division has the same priority

#

Pretty sure about that

clear venture
#

oh you're right

#

til

#

thought mod was below those on precedence

fleet bridge
#

im stoopid, it is doing 7+1 and 8+0, so it is always 8

distant salmon
#

!e

for x in 7,8:
  print(7+0**(x&8))
fleet bridge
#

x-1+ord(str(x))%7//3
this should work

night quarryBOT
#

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

001 | 8
002 | 7
fleet bridge
#

!e

for x in 7,8:
  print(x-1+ord(str(x))%7//3)
night quarryBOT
#

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

001 | 8
002 | 7
fleet bridge
#

yay

clear venture
#
>>> def f(x): print(*({x} ^ {7,8}))
... 
>>> f(8)
7
>>> f(7)
8
fleet bridge
#

({x}^{7,8}).pop() also should work

#

sorted([7,8],key=x.__eq__)[0]

#

range(x,30-3*x,15-2*x)[1]

gleaming linden
#

next(filter(x.__ne__,[7,8]))

clear venture
gleaming linden
#

Oh yeah right

fleet bridge
#

7+(x==7)

#

8-(x==8) ๐Ÿ˜„

clear venture
#
>>> def f(x): print(__import__('functools').reduce(lambda x,y: x ^ y, [x,7,8]))
... 
>>> f(8)
7
>>> f(7)
8
fleet bridge
#

i like that

#

oh wait, (a^b)^x works for every a,b pair, not only for those which has no common set bits (idk why i thought so)
so 15^x can be extended to a^b^x just like 15-x can be extended to a+b-x

clear venture
#

I didn't think about that either, the similarity there

fleet bridge
clear venture
#

8-(
8)

fleet bridge
#

(x

#

if you count this, there are three

clear venture
#

๐Ÿค

fleet bridge
#

7*8//x

#

idk noone though of this

clear venture
#
>>> -~-~-~-~-~-~-~(7 >> 3 ^ 1)
8
>>> -~-~-~-~-~-~-~(8 >> 3 ^ 1)
7
fleet bridge
#

!e ```py

i forgot how this operation is called

def G(x,y): return 1/(1/x+1/y)

for x in 7,8:
print(1/(1/G(G(7,8),x)-1/G(7,8)))

night quarryBOT
#

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

001 | 7.0
002 | 8.0
fleet bridge
#

oh wait

#

i again invented identity function

clear venture
#

gotta have that floor division

#

based

fleet bridge
#

!e ```py
def G(x,y): return 1/(1/x-1/y)

for x in 7,8:
print(G(G(7,-8),x))

night quarryBOT
#

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

001 | 8.0
002 | 7.0
fleet bridge
#

๐Ÿฅณ

#

!e ```py
from math import *
for x in 7,8:
print(log(exp(7)*exp(8)/exp(x)))

night quarryBOT
#

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

001 | 8.0
002 | 7.0
fleet bridge
#

!e ```py
from math import *
for x in 7,8:
print(exp(log(7)+log(8)-log(x)))

night quarryBOT
#

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

001 | 7.999999999999995
002 | 6.999999999999998
fleet bridge
#

almooost

unique heath
#

avg float shenanigans

#

!e

from math import *
for x in 7,800001:
  print(exp(log(7)+log(8)-log(x)))```
night quarryBOT
#

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

001 | 7.999999999999995
002 | 6.999991250010937e-05
fleet bridge
#
match x:
  case 7:
    return 8
  case 8:
    return 7
#
try:
  1/(7-x)
except:
  return 8
else:
  return 7
#

!e (the same as 7*8/x) ```py
from math import *
for x in 7,8:
print(lcm(7,8)//x)

night quarryBOT
#

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

001 | 8
002 | 7
fleet bridge
#

!e ```py
from math import *
for x in 7,8:
print(8-(gcd(14,x)-2)//5)

night quarryBOT
#

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

001 | 7
002 | 8
fleet bridge
#

hello, identity function

#

!e ```py
from math import *
for x in 7,8:
print(7+(gcd(14,x)-2)//5)

night quarryBOT
#

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

001 | 8
002 | 7
fleet bridge
#

!e ```py
from math import *
for x in 7,8:
print(3+gcd(14,x)**2%11)

night quarryBOT
#

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

001 | 8
002 | 7
fleet bridge
#

!e ```py
from math import *
for x in 7,8:
print(4+factorial(x)%13//2)

night quarryBOT
#

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

001 | 8
002 | 7
fleet bridge
#

!e ```py
from ctypes import *
for x in 7,8:
print(py_object.from_address(id(7)+id(8)-id(x)))

night quarryBOT
#

@fleet bridge :warning: Your 3.11 eval job has completed with return code 139 (SIGSEGV).

[No output]
fleet bridge
#

huh what

#

ctypes always will be a bloated black box to me

rugged sparrow
# fleet bridge huh what

!e py_object dereferences the address passed in to a pointer. It's a bit like PyObject**, you can use _ctypes.PyObj_FromPtr to run that code ```py
from _ctypes import PyObj_FromPtr
for x in 7,8:
print(PyObj_FromPtr(id(7)+id(8)-id(x)))

night quarryBOT
#

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

001 | 8
002 | 7
clear venture
orchid glen
#

๐Ÿ—ฟ

orchid nymph
#

!e

def f(x):print(x^15)
*map(f,(7,8)),
night quarryBOT
#

@orchid nymph :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | 8
002 | 7
unique heath
#

!e

import einspect

@einspect.impl(int)
def __eq__(self):
    return self == 8 or self == 7

print(8 == 7)```
night quarryBOT
#

@unique heath :x: Your 3.11 eval job has completed with return code 139 (SIGSEGV).

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 3, in <module>
003 |     @einspect.impl(int)
004 |      ^^^^^^^^^^^^^^^^^^
005 |   File "/snekbox/user_base/lib/python3.11/site-packages/einspect/views/view_type.py", line 265, in wrapper
006 |     t_view[name] = func
007 |     ~~~~~~^^^^^^
008 |   File "/snekbox/user_base/lib/python3.11/site-packages/einspect/views/view_type.py", line 407, in __setitem__
009 |     with self.as_mutable():
010 |   File "/lang/python/default/lib/python3.11/contextlib.py", line 144, in __exit__
011 |     next(self.gen)
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/S7BMMF5CMVBJR6NOO4FE4BFATE

unique heath
#

awws

fleet bridge
low lynx
#

oh right

#

scaled harmonic mean?

#

idk

low lynx
#

I guess it's also the l-1 norm

still totem
#

!e

x = lambda x: x*3
print(x(9))
night quarryBOT
#

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

27
still totem
#

huh

#

i never figured out how lambdas really worked until now

magic wraith
unborn lance
#

Hi, I dont know where to ask this, but in a python dataframe, how do I compare 3 columns if to check if they have null values at the same places. The other values are all different categorical ones. I need to write a command which will give me True if all the three columns have null at the same rows.

olive beacon
#

Is there anyway to bypass enforced types from dunder methods?
ex. allow for contains to return non booleans

v = res ? Py_True : Py_False;//skip tihs
low lynx
#

!e again, __contains__ isn't the issue, it's the __bool__ that gets called by the in keyword

class Foo:
    def __contains__(self, item):
        return Bar()
class Bar:
    def __bool__(self):
        return 2
f = Foo()
print(f.__contains__(1))
print(1 in f)
night quarryBOT
#

@low lynx :x: Your 3.11 eval job has completed with return code 1.

001 | <__main__.Bar object at 0x7f37aa048090>
002 | Traceback (most recent call last):
003 |   File "/home/main.py", line 9, in <module>
004 |     print(1 in f)
005 |           ^^^^^^
006 | TypeError: __bool__ should return bool, returned int
olive beacon
#

What I mean by magic

class T:
    def __init__(self):
        self.__add__=lambda s,x:x+1
    def __add__(self,x):
        return x+2
T()+1#3
#

!e```py
class T:
def init(self):
self.add=lambda s,x:x+1
print(T()+1)

night quarryBOT
#

@olive beacon :x: Your 3.11 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 4, in <module>
003 |     print(T()+1)
004 |           ~~~^~
005 | TypeError: unsupported operand type(s) for +: 'T' and 'int'
restive void
#

I.e. x + y doesn't do x.__add__(y), but rather something like type(x).__add__(x, y).

quartz wave
#

unless you do some machine code modifying

olive beacon
olive beacon
karmic pumice
#

any information on when einspect.impl come to 3.12

#

!e

import einspect

@einspect.impl(str)
def thingy(self):
  print("test")

'123'.thingy()
night quarryBOT
#

@karmic pumice :x: Your 3.11 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 7, in <module>
003 |     '123'.thingy()
004 |     ^^^^^^^^^^^^
005 | AttributeError: 'str' object has no attribute 'thingy'
karmic pumice
#

so join 2 first items with , then add a space and then join by x's?

versed eagle
#

a,b,*s=s.split();s=a+','+b+" "+"x".join(s[2:])

karmic pumice
#

i wanted to do stuff with enumerate but it gets worse
long word

versed eagle
#

a yeah

#

i forgot to remove that bit

low lynx
#

are we assuming that there are at least 2 elements?

versed eagle
#

presumably

rugged sparrow
#

!e ```py
import fishhook

@fishhook.hook(str)
def thingy(self):
print("test")

'123'.thingy()
import sys;print(sys.version)

night quarryBOT
#

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

001 | test
002 | 3.12.0 (main, Oct  3 2023, 03:05:14) [GCC 12.2.0]
rugged sparrow
#

sweet fishhook works

versed eagle
#

โœจ

coarse void
#

Task:
You have to get a string as an input of your code. Output whether the string contains any of "aeiou", if yes how many times, and where. Use proper output messages, and try to be as concise as possible!
My attempt:

s = input("Give a string!\n\t> ").lower()
print("\n".join(["\n".join(["",f"{'-'*30} Char: "+i, "Contains" if i in s else "Doesn't contain", str(s.count(i))+" times", "At places: "+", ".join([str(ind+1) for ind,j in enumerate(s) if j == i])][:(6 if i in s else 3)]) for i in "aeiou"]))

last locust
#

And x if y else z -> [x,z][y]

#

And str(x)+"y" -> f"{x}y"

coarse void
#

That leaves us with

s=input("Give a string!\n\t> ").lower()
print("\n".join(["\n".join(["",f"{'-'*30} Char: "+i,["Doesn't contain",f"Contains {s.count(i)} times"][i in s],"At places: "+", ".join([str(n+1)for n,j in enumerate(s)if j==i])][:[3,6][i in s]])for i in"aeiou"]))
versed eagle
#

"Contains" if i in s else "Doesn't contain"
i in s and"Contains"or"Doesn't contain"
"Contains"*(i in s)or"Doesn't contain"

coarse void
#

Can get a few characters with unpacking as well

s=input("Give a string!\n\t> ").lower()
print(*["\n".join(["",f"{'-'*30} Char: "+i,["Doesn't contain",f"Contains {s.count(i)} times"][i in s],"At places: "+", ".join([f"{n+1}"for(n,j)in enumerate(s)if j==i])][:[3,6][i in s]])for(i)in"aeiou"])
versed eagle
#

242 (yours) ```py
s=input("Give a string!\n\t> ").lower()
print(*["\n".join(["",f"{'-'*30} Char: "+i,["Doesn't contain",f"Contains {s.count(i)} times"][i in s],"At places: "+", ".join([f"{n+1}"for(n,j)in enumerate(s)if j==i])][:[3,6][i in s]])for(i)in"aeiou"])

226 ```py
s=input("Give a string!\n\t> ").lower()
for(n,c)in zip(map(s.count,v:="aeiou"),v):print('-'*30+' Char: '+c,n and f"Contains {n} times\nAt places: "+", ".join(str(i+1)for(i,j)in enumerate(s)if j==c)or"Doesn't contain",sep='\n')
#

wait actually

#

225

s=input("Give a string!\n    > ").lower()
for(n,c)in zip(map(s.count,v:="aeiou"),v):print('-'*30+' Char: '+c,n and f"Contains {n} times\nAt places: "+", ".join(str(i+1)for(i,j)in enumerate(s)if j==c)or"Doesn't contain",sep='\n')
#

you can embed the tab byte directly for more shortness :>

#

<TAB> is 1 byte, \t is 2

#

aw discord replaces it with spaces

#

very sad

#

oh well

#

its still possible

versed eagle
#

that would mean if the user inputs AEIOU it will say that it contains all the letters despite the original string not containing any of aeiou

#

that seems like a bug

versed eagle
#

209

s=input("Give a string!\n\t> ")
for c in(v:="aeiou"):n=s.count(c);print('-'*30+' Char: '+c,n and f"Contains {n} times\nAt places: "+", ".join(str(i+1)for(i,j)in enumerate(s)if j==c)or"Doesn't contain",sep='\n')
coarse void
versed eagle
#

oh

#

Output whether the string contains any of "aeiou",

#

that's misleading then

coarse void
#

I am thinking so hard whether is there a shorter solution with "re"

versed eagle
coarse void
#

Yeah, but now it creates 10 categories instead of 5

versed eagle
#

oh right

#

oh well

fleet bridge
#

!e ```py
s = 'xxxaaxeexaioxu'
#s=input("Give a string!\n\t> ")
for c in(v:="aeiou"):n=s.count(c);print('-'*30+' Char: '+c,n and f"Contains {n} times\nAt places: "+", ".join(str(i+1)for(i,j)in enumerate(s)if j==c)or"Doesn't contain",sep='\n')

night quarryBOT
#

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

001 | ------------------------------ Char: a
002 | Contains 3 times
003 | At places: 4, 5, 10
004 | ------------------------------ Char: e
005 | Contains 2 times
006 | At places: 7, 8
007 | ------------------------------ Char: i
008 | Contains 1 times
009 | At places: 11
010 | ------------------------------ Char: o
011 | Contains 1 times
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/22HSBZW7PVLM47K536XF6M3SZA

versed eagle
#

i guess .lower is shortest then

coarse void
#

RegEx still bogs my mind

#

Must be something

versed eagle
#

[aeiou]

coarse void
#

Something with the same output ๐Ÿ˜‚

versed eagle
#

this checks for matches of an individual character f"{c}|{chr(ord(c)+32)}"

#

no im too tired to count

#

you'd just use c.upper

#

its way shorter

#

i should have slept last night lmao

coarse void
#

Isn't there something like /[aeiou] /i for case-insensitive match? I mostly write typescript so Im thinking that way

versed eagle
#

there's a flag yeah

#

but its not in the string

coarse void
#

I'll keep thinking then

versed eagle
#

re.I is the flag for ignorecase

coarse void
#

So you say with vanilla python 217 is the floor wo. Changing how the output looks?

versed eagle
#

what?

#

[wo.]?

coarse void
#

Without

versed eagle
#

oh

#

let me check the output actually

versed eagle
#

it was missing newlines

#
------------------------------ Char: a
Contains 2 times
At places: 1, 10
------------------------------ Char: e
Contains 2 times
At places: 5, 14
------------------------------ Char: i
Contains 2 times
At places: 9, 18
------------------------------ Char: o
Doesn't contain
------------------------------ Char: u
Doesn't contain
``` instead of ```
------------------------------ Char: a
Contains 2 times
At places: 1, 10

------------------------------ Char: e
Contains 2 times
At places: 5, 14

------------------------------ Char: i
Contains 2 times
At places: 9, 18

------------------------------ Char: o
Doesn't contain

------------------------------ Char: u
Doesn't contain

using s = "abcdefghiabcdefghi"

versed eagle
coarse void
#

Nice

versed eagle
#

222, fstrings are cool ```py
s=input("Give a string!\n\t> ").lower()
for c in(v:="aeiou"):n=s.count(c);print('-'*30+' Char: '+c,n and f"Contains {n} times\nAt places: {', '.join(str(i+1)for(i,j)in enumerate(s)if j==c)}\n"or"Doesn't contain\n",sep='\n')

#

output is the same

#

im gonna go eat since i haven't done that yet

#

ping me if you get it shorter

orchid nymph
#

!e

s="abcdefghiabcdefghi"
#s=input("Give a string!\n   > ").lower()
for c in"aeiou":n=s.count(c);print('-'*30+f' Char: {c}\n'+[f"Contains {n} times\nAt places: {", ".join(str(i+1)for(i,j)in enumerate(s)if j==c)}","Doesn't contain\n"][n<1])
night quarryBOT
#

@orchid nymph :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | ------------------------------ Char: a
002 | Contains 2 times
003 | At places: 1, 10
004 | ------------------------------ Char: e
005 | Contains 2 times
006 | At places: 5, 14
007 | ------------------------------ Char: i
008 | Contains 2 times
009 | At places: 9, 18
010 | ------------------------------ Char: o
011 | Doesn't contain
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/UUN7ZEFU6DH3X7LZ5NBCISPM3Y

orchid nymph
#

212

#

@versed eagle

#

!e 203

s="abcdefghiabcdefghi"
#s=input("Give a string!\n\t> ").lower()
for c in"aeiou":n=s.count(c);print('-'*30+f' Char:',*n and[f"{c}\nContains {n} times\nAt places:",*[i for(i,j)in enumerate(s)if j==c]]or[f"{c}\nDoesn't contain\n"])
night quarryBOT
#

@orchid nymph :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | ------------------------------ Char: a
002 | Contains 2 times
003 | At places: 0 9
004 | ------------------------------ Char: e
005 | Contains 2 times
006 | At places: 4 13
007 | ------------------------------ Char: i
008 | Contains 2 times
009 | At places: 8 17
010 | ------------------------------ Char: o
011 | Doesn't contain
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/34AKJWZXKZP6CO2T4PD6POPVRI

orchid nymph
#

!e 196

s="abcdefghiabcdefghi"
#s=input("Give a string!\n\t> ").lower()
for c in"aeiou":n=s.count(c);print('-'*30,'Char:',*n and[c+"\nContains",n,"times\nAt places:"]+[i for(i,j)in enumerate(s)if j==c]or[c+"\nDoesn't contain\n"])
night quarryBOT
#

@orchid nymph :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | ------------------------------ Char: a 
002 | Contains 2 times
003 | At places: 0 9
004 | ------------------------------ Char: e 
005 | Contains 2 times
006 | At places: 4 13
007 | ------------------------------ Char: i 
008 | Contains 2 times
009 | At places: 8 17
010 | ------------------------------ Char: o
011 | Doesn't contain
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/3NTUT6UIZU6XYNJJV5VU6HQJ5U

orchid nymph
#

ops didn't notice the "," actually :3 so 209 with sep=', '. I will stop her

orchid nymph
#

also I typed 3 spaces instead of tab, and counted the spaces (changed it to \t and counted it as 1 byte)

versed eagle
#

discord doesnt let you embed the <TAB> character

#

it converts to spaces

#

we're just assuming its there

orchid nymph
#

actually can't do it my way

#

I need to rewrite it with ', '

versed eagle
#

a

orchid nymph
orchid nymph
#

!e there you go a 206 with ', ' I will leave it at that

s="abcdefghiabcdefghi"
#s=input("Give a string!\n\t> ").lower()
for c in"aeiou":n=s.count(c);print('-'*30,f'Char: {c}\n'+[f"Contains {n} times\nAt places: "+", ".join(str(i+1)for(i,j)in enumerate(s)if j==c),"Doesn't contain"][n<1])
night quarryBOT
#

@orchid nymph :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | ------------------------------ Char: a
002 | Contains 2 times
003 | At places: 1, 10
004 | ------------------------------ Char: e
005 | Contains 2 times
006 | At places: 5, 14
007 | ------------------------------ Char: i
008 | Contains 2 times
009 | At places: 9, 18
010 | ------------------------------ Char: o
011 | Doesn't contain
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/LX3YLIFX2DREGI7CJ7RDXQZIMI

versed eagle
#

:<

#

i am too tired for this lmao

untold gate
#

!e

s="""Buy it, use it, break it, fix it, trash it, change it, mail, upgrade it
Charge it, point it, zoom it, press it, snap it, work it, quick erase it
Write it, cut it, paste it, save it, load it, check it, quick rewrite it
Plug it, play it, burn it, rip it, rip it, Lock it, fill it, call it, find it, view it, code it, jam, unlock it
Surf it, scroll it, pause it, click it, cross it, crack it, switch, update it
Name it, read it, tune it, print it, scan it, send it, fax, rename it""".lower()
#s=input("Give a string!\n\t> ").lower()
for c in"aeiou":n=s.count(c);print('-'*30,f'Char: {c}\n'+[f"Contains {n} times\nAt places: "+", ".join(str(i+1)for(i,j)in enumerate(s)if j==c),"Doesn't contain"][n<1])
night quarryBOT
#

@untold gate :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | ------------------------------ Char: a
002 | Contains 22 times
003 | At places: 20, 37, 47, 57, 66, 75, 115, 139, 165, 175, 185, 230, 281, 317, 352, 383, 402, 410, 420, 448, 465, 472
004 | ------------------------------ Char: e
005 | Contains 24 times
006 | At places: 11, 19, 50, 68, 78, 105, 137, 141, 150, 168, 177, 194, 209, 214, 300, 310, 355, 404, 412, 419, 430, 456, 470, 474
007 | ------------------------------ Char: i
008 | Contains 62 times
009 | At places: 5, 13, 23, 28, 31, 41, 52, 58, 70, 80, 86, 90, 99, 109, 118, 127, 133, 143, 148, 152, 160, 170, 179, 188, 198, 204, 212, 216, 224, 233, 242, 247, 250, 255, 258, 267, 272, 276, 285, 290, 294, 299, 303, 312, 328, 336, 347, 357, 363, 367, 377, 387, 393, 406, 414, 423, 432, 438, 442, 451, 460, 476
010 | ------------------------------ Char: o
011 | Contains 10 times
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/T5IMIZWYBPVQBLMFDCYTKFTQ5A

orchid nymph
#

\t is 1 character

quartz wave
#

mki

orchid nymph
#

!e 203

s="abcdefghiabcdefghi"
#s=input("Give a string!\n\t> ").lower()
for c in"aeiou":n=s.count(c);print('-'*30,f'Char: {c}\n'+[f"Contains {n} times\nAt places: "+str([i+1for(i,j)in enumerate(s)if j==c])[1:-1],"Doesn't contain"][n<1])
night quarryBOT
#

@orchid nymph :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | /home/main.py:3: SyntaxWarning: invalid decimal literal
002 |   for c in"aeiou":n=s.count(c);print('-'*30,f'Char: {c}\n'+[f"Contains {n} times\nAt places: "+str([i+1for(i,j)in enumerate(s)if j==c])[1:-1],"Doesn't contain"][n<1])
003 | ------------------------------ Char: a
004 | Contains 2 times
005 | At places: 1, 10
006 | ------------------------------ Char: e
007 | Contains 2 times
008 | At places: 5, 14
009 | ------------------------------ Char: i
010 | Contains 2 times
011 | At places: 9, 18
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/3343X4DV7OLEDAS6U5BMPWMKPY

quartz wave
#

!e 200 ```py
s="abcdefghiabcdefghi"
#s=input("Give a string!\n\t> ").lower()
for c in"aeiou":l=[i+1for(i,j)in enumerate(s)if j==c];print('-'*30,f'Char: {c}\n'+["Doesn't contain",f"Contains {len(l)} times\nAt places: "+str(l)[1:-1]][l>[]])

night quarryBOT
#

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

001 | /home/main.py:3: SyntaxWarning: invalid decimal literal
002 |   for c in"aeiou":l=[i+1for(i,j)in enumerate(s)if j==c];print('-'*30,f'Char: {c}\n'+["Doesn't contain",f"Contains {len(l)} times\nAt places: "+str(l)[1:-1]][l>[]])
003 | ------------------------------ Char: a
004 | Contains 2 times
005 | At places: 1, 10
006 | ------------------------------ Char: e
007 | Contains 2 times
008 | At places: 5, 14
009 | ------------------------------ Char: i
010 | Contains 2 times
011 | At places: 9, 18
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/6DXZXHML7AKQJITP73JHM4OJF4

versed eagle
#

but the actual string can contain a <TAB> instead of \t

orchid nymph
#

!e 199

s="abcdefghiabcdefghi"
#s=input("Give a string!\n\t> ").lower()
for c in"aeiou":print('-'*30,f'Char: {c}\n'+["Doesn't contain",f"Contains {len(l:=[i+1for(i,j)in enumerate(s)if j==c])} times\nAt places: "+str(l)[1:-1]][l>[]])
night quarryBOT
#

@orchid nymph :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | /home/main.py:3: SyntaxWarning: invalid decimal literal
002 |   for c in"aeiou":print('-'*30,f'Char: {c}\n'+["Doesn't contain",f"Contains {len(l:=[i+1for(i,j)in enumerate(s)if j==c])} times\nAt places: "+str(l)[1:-1]][l>[]])
003 | ------------------------------ Char: a
004 | Contains 2 times
005 | At places: 1, 10
006 | ------------------------------ Char: e
007 | Contains 2 times
008 | At places: 5, 14
009 | ------------------------------ Char: i
010 | Contains 2 times
011 | At places: 9, 18
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/FBZRFJCIGNA3YVBLJ6TXZWBUOU

tacit thunder
#

hello

#

I need help

#
x = int(input("What is your code: "))

print(x[0])
#

Is this even possible

#

to print the first letter of a user's input

#

or in this case number

gleaming linden
unique heath
#

!e

__builtins__.__getattribute__(__builtins__.__dir__().__getitem__(__builtins__.__dir__().__len__().__floordiv__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__()).__add__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__()).__add__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__()).__add__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__()))))).__add__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__())).__add__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__())).__add__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__()))))("hello world")```
night quarryBOT
#

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

hello world
unique heath
#

essentially how it works is

it gets __builtins__.__dir__()'s 42nd item by using __builtins__.__dir__().__len__() and dividing by 4, and then adding 3

#

and then uses __getattribute__

#

basically __builtins__.__dir__().__len__() // __name__.__dir__().__len__() = 1, so pretty easy tog o from there

terse dagger
#

i'll keep doing simple functions :/

#

and trying not to cry

unique heath
#

!e

(__:=__builtins__.__getattribute__(__builtins__.__dir__().__getitem__(__builtins__.__dir__().__len__().__floordiv__(__builtins__.__dir__().__len__().__floordiv__(__package__.__dir__().__len__())).__floordiv__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__()).__add__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__()))).__add__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__())))),__builtins__.__getattribute__(__builtins__.__dir__().__getitem__(__builtins__.__dir__().__len__().__floordiv__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__()).__add__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__()).__add__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__()).__add__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__()))))).__add__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__())).__add__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__())).__add__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__()))))(__name__.__class__.__call__().join(list(map(__, [104,101,108,108,111,32,119,111,114,108,100])))))
night quarryBOT
#

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

hello world
unique heath
#

kinda afraid of getting past char limit

unique heath
#

!e

(_:=__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__()),__:=__builtins__.__getattribute__(__builtins__.__dir__().__getitem__(__builtins__.__dir__().__len__().__floordiv__(__builtins__.__dir__().__len__().__floordiv__(__package__.__dir__().__len__())).__floordiv__(_.__add__(_)).__add__(_))),__builtins__.__getattribute__(__builtins__.__dir__().__getitem__(__builtins__.__dir__().__len__().__floordiv__(_.__add__(_.__add__(_.__add__(_)))).__add__(_).__add__(_).__add__(_)))(__name__.__class__.__call__().join(list(map(__, [104,101,108,108,111,32,119,111,114,108,100])))))``` less words for more obfuscat
night quarryBOT
#

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

hello world
orchid nymph
#

!e

from __hello__ import*;main()
night quarryBOT
#

@orchid nymph :white_check_mark: Your 3.12 eval job has completed with return code 0.

Hello world!
tacit thunder
night quarryBOT
#

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

Hello world!
karmic pumice
#

fishhook.hook for object when?

fleet bridge
rugged sparrow
#

!e ```py
from fishhook import hook

@hook(object)
def matmul(self, other):
return (self, other)

print(1 @ 2)
print(import('sys').version)

night quarryBOT
#

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

001 | (1, 2)
002 | 3.12.0 (main, Oct  3 2023, 03:05:14) [GCC 12.2.0]
rugged sparrow
magic garnet
#

!e

night quarryBOT
#
Missing required argument

code

magic garnet
#

!e 2.6

vapid magnet
#

Hello, I'm trying to change "def" to "func" in cpython syntax. Can anyone get hint where I can find this keyword?

vast wave
vapid magnet
vast wave
versed eagle
#

dont edit the parser by hand

#

just edit the grammar file and then run make pegen or whatever the command is

#

though you will then have to edit every single of the stdlib files that python has

#

but that can be automated

versed eagle
#

dont edit the generated parser, it's bad for your mental health

vapid magnet
#

Yeah, I did it with make regen-pegen, but I need some work around Lib/*.py. A lot of package contains func as variable...

vapid magnet
odd light
#

@hard spoke re my help post from earlier, apparently the course's grading/testing suite does import functools

#

so now i have to figure out how to reload the module without using importlib or sys lmao

vapid magnet
arctic skiff
#

please add braces

vapid magnet
fleet bridge
#

๐Ÿฅณ

flint hollow
#

if you're going to insist on braces, then i insist on one thing: if the program uses a brace style other than OTBS, it should crash

quartz wave
#

and i have failed

flint hollow
unique heath
#

lmao thurisatic is so happy

arctic skiff
quartz wave
unique heath
#

we believe in you cereal

last locust
arctic skiff
flint hollow
# versed eagle whats otbs?

alternatively spelled 1TBS, "one true brace style"

In computer programming, an indentation style is a convention governing the indentation of blocks of code to convey program structure. This article largely addresses the free-form languages, such as C and its descendants, but can be (and often is) applied to most other programming languages (especially those in the curly bracket family), where w...

versed eagle
#

k&r style is better (but with mandatory braces ofc)

fleet bridge
#

@karmic pumice

karmic pumice
#

rest in peace, mind checking it in a repl [preferably ipython]? i usually do all stuff in it so ๐Ÿคท

fleet bridge
#

it happened in repl

#

works with fishhook too

#

ipython is too heavy for this
it keeps spamming infinitely

karmic pumice
#

certified repl incident

vast wave
fleet bridge
#

i guess optimizer calls int.__add__ at compile time, so if compile time happens after some runtime, it can call non-original method ๐Ÿ˜„

vast wave
#

the compiler is in c

#

it does not have int.__add__

#

and making a detour like that to the rest of the interpreter just to add 2 numerical constants is a bit silly

#

you can try it tho

#

compile("print(1+2)", "", "exec")

fleet bridge
#

9700 6400 5300 - this is bytecode for 1 + 2

#
>>> dis.opname[0x97]
'RESUME'
>>> dis.opname[0x64]
'LOAD_CONST'
>>> dis.opname[0x53]
'RETURN_VALUE'
#

that makes sense

#

optimizer noticed literal + literal situation and added them together, but i changed how addition works and it received wrong result

#

that is interesting, i didnt know that is possible (i thought optimizer calls int.__add__ directly, not through int class)

long fulcrum
#

is there a shorter way of checking if a float is an int than n.is_integer()

#

ah got it

long fulcrum
#

i used n%1==0

unique heath
#

wrong channel

versed eagle
unique heath
versed eagle
#

read the description lol

long fulcrum
#

this channels for golfing

versed eagle
#

very first thing listed is golfing

versed eagle
#

great, cause that's where we are :p

unique heath
#

niabufbdifjoiajijdoisgoih iohoue

versed eagle
#

python discord is a great place to be

#

lol

long fulcrum
#

how can this be shortened py if(sum(x:=[...])/len(x))%1==0

versed eagle
#

that wont work

long fulcrum
#

it works

versed eagle
#

!e

print(sum([...]))
night quarryBOT
#

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

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 1, in <module>
003 |     print(sum([...]))
004 |           ^^^^^^^^^^
005 | TypeError: unsupported operand type(s) for +: 'int' and 'ellipsis'
versed eagle
long fulcrum
#

it is working

#

its inside a list comp

long fulcrum
#

the ... is filler

versed eagle
#

0 + ... doesn't work

versed eagle
#

wdym

long fulcrum
#

like i have more code in there

versed eagle
#

no?

#

you have ... there

long fulcrum
#

its filler

#

im just showing the bits i want to

#

its just a list

versed eagle
#

oh

#

then the length is known beforehand so you can put the constant there

long fulcrum
#

its a list comprehension

versed eagle
long fulcrum
#

it changes

versed eagle
#

get your story straight,

rugged sparrow
fleet bridge
#

i know, and i showed that (but I wasn't doing compile in repl because my repl is too fancy)
i also showed that peepholer indeed optimized that, and it used value i gave him

fleet bridge
# fleet bridge

there im running compile, and it triggers hook (but in this case hook doesn't print anything, so it is less obvious)

fleet bridge
#

also, if your "if" has "else" branch, yiu can omit ==0 part and swap branches

#

also you can replace (...)%1==0 with not(...)%1, that takes same amount of chars
not will execute after %, so its fine

fleet bridge
#

you are essentially checking if a/b is an integer
that happens only if a is divisible by b
so you can replace a/b%1==0 with a%b==0, that is -2 chars

#

and you still can omit ==0 by swapping if-else branches, if you have them, of course

#

so its like ```py
if sum(x:=[...])%len(x): ... # not int
else: ... # int

if sum(x:=[...])%len(x)==0: ... # int

#

i dont see a way to shorten it further without any knowledge about list comprehension

versed eagle
#

thats,, rude

#

tbh i did not expect to see something like that from you denball

fleet bridge
#

I didn't mean to be rude. I just suggested that you pay a little more attention to the problem, and not to nit-picking

versed eagle
#

nit-picking?

#

what's that

clear venture
# versed eagle nit-picking?

Focusing on tearing apart others for minor things that don't matter much. Saying things like "get your story straight" is pretty rude

vast wave
long fulcrum
#

idk why it works but it does

#

so thats -1

#

and bc its <1 i can now do this

#

sum(x:=[...])%len(x)<1==print(i)

#

getting rid of the if

finite blaze
#

Hey, I have a small golfing challange for ya
You have a 2d grid, n width and m high. Each cell in the grid can store 0 on 1, 0 being a free space and 1 being a wall.
Imagine a Battleship game, u have x long ship and u can place it horizontally or vertically on the grid. The challange is to find a cell with the highest probability of being a ship.

#

in this example

#

this would be the best cell

gleaming linden
finite blaze
gleaming linden
#

but you said find "a" cell with the highest probablility fine

finite blaze
gleaming linden
#

and how about I/O?

#

are the variables already defined?

#

or read from stdin?

finite blaze
#
shipLength = 3
grid = [
    [0,0,0,0,1],
    [0,1,1,0,0],
    [0,0,0,0,0],
    [1,1,0,0,0],
    [0,0,0,0,0]
]

Let's say they are already defined

gleaming linden
#

CP-style input might be shorter lol

finite blaze
gleaming linden
#

competitive programming

#

a format like ```
n m x
0 0 0 0 0
0 0 0 0 0
...

#

into stdin

#

because I'm thinking of just flattening the 2d list anyway

finite blaze
#

or just do whatever you want ;p

#

im gonna give it a go too

gleaming linden
#

and output?

#

maybe just one x y pair per line?

finite blaze
#

yep

gleaming linden
#

x is row and y is column?

#

0-indexed?

finite blaze
#

yes

gleaming linden
#

So x y would be grid[y][x]

finite blaze
#

yup

gleaming linden
#

Cool

proper vault
#
g=[''.join(map(str,u))for u in grid]
x=shipLength
a=[[min(j+1,i-x+1,i-j) for j in range(i)] if i>=x else[0]*i for i in range(6)]
v=[sum((a[len(q)]+[0] for q in r.split('1')),[])for r in g]
w=[sum((a[len(q)]+[0] for q in ''.join(r).split('1')),[])for r in zip(*g)]
t=[sum(x)for r in zip(v,zip(*w))for x in zip(*r)]
[print(i%5,i//5)for i,q in enumerate(t) if q==max(t)]```passes the one testcase, didn't test it further.
gleaming linden
#

Hmm, strings are interesting

#

I was thinking of g=sum(grid,[]) and not any(g[ <something> ])

proper vault
#

It seemed fairly fitting since the result depends on the length of the 0 runs

finite blaze
#
grid = [
    [1,0,1,0,1],
    [1,1,1,1,0],
    [0,0,1,0,1],
    [1,1,0,1,0],
    [0,0,1,0,0]
]
#

so 3 long ship cant fit here

proper vault
#

interesting

#

it finds a vertical spot somehow

finite blaze
gleaming linden
#

There's also the trivial case of x=1

#

For other things to test

proper vault
#

hmm, my x handling could be entirely wrong

proper vault
# finite blaze

Ah nvm, it is correct, it reports every spot since every spot can contain the ship with the highest probability, I was copy pasting wrong before.

#

min(j+1,i-x+1,i-j,x) This may be needed for x other than 3

gleaming linden
#

but walls can't have a ship

proper vault
#

neither can any other spot

gleaming linden
#

oh true

gleaming linden
#
x=shipLength
M=i=0
n=len(grid[0])
g=sum(grid,L:=[])
for _ in g:
    i+=1
    print(x-sum(o%n>n-x or any(g[o:o+x])for o in range(i-x,i)))
``` horizontal checking is working
gleaming linden
#
x=shipLength
M=2*x
n=len(grid[i:=0])
g=sum(grid,L:=[])
for _ in g:
 p=sum(o%n>n-x or any(g[o:o+x])for o in range(i-x+1,i+1))+sum(0>o or o+x*n>len(g)or any(g[o:o+x*n:n])for o in range(i-x*n+n,i+n,n))
 if p<M:M,*L=p,
 L+=[i]*(p==M);i+=1
for i in L:print(i//n,i%n)
``` 261, works as far as I can tell
#

@finite blaze

quartz wave
gleaming linden
versed eagle
#

,, how am i supposed to answer their question if they keep changing their question

distant salmon
gleaming linden
#

p counts the number of invalid boat placements

#

So if all boats are invalid (which would be the least probability) then p would be 2x

distant salmon
#

Since if p<M:M,*L=p, should always trigger first iteration

#

hmm

gleaming linden
#

it wouldn't, if none of the placements are valid

#

actually, M=3*x should fix that

distant salmon
#

ye

gleaming linden
#
x=shipLength
M=3*x
n=len(grid[i:=0])
g=sum(grid,[])
for _ in g:
 p=sum(any(g[(a:=o*n+i)-x*n:a:n]+[x*n>a,a>len(g)])+any([(b:=o-x+i)%n>n-x]+g[b:o+i])for o in range(1,x+1))
 if p<M:M,*L=p,
 L+=[i]*(p==M);i+=1
for i in L:print(i//n,i%n)
``` 232
distant salmon
gleaming linden
distant salmon
#

!e

A = [[1,2], [3,4]]
print(sum(A, []))

A = ["12", "34"]
print(sum(A, ""))

What is the reason why sum with [] works, but sum with "" doesn't work? Has sum been hardcoded to not allow strings?

night quarryBOT
#

@distant salmon :x: Your 3.12 eval job has completed with return code 1.

001 | [1, 2, 3, 4]
002 | Traceback (most recent call last):
003 |   File "/home/main.py", line 5, in <module>
004 |     print(sum(A, ""))
005 |           ^^^^^^^^^^
006 | TypeError: sum() can't sum strings [use ''.join(seq) instead]
clear venture
distant salmon
#

๐Ÿ˜ฉ

night quarryBOT
#

Python/bltinmodule.c line 2515

/* reject string values for 'start' parameter */```
fleet bridge
restive void
#

!e

print(
sum(["a", "b"], type("", (), {"__add__":"".__add__})())
)
night quarryBOT
#

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

ab
distant salmon
#

I really wish sum would work in the same way as min and max

#

!e

A = [2,3]
print(min(A))
print(min(2,3))
print(min(A, default=-123))
night quarryBOT
#

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

001 | 2
002 | 2
003 | 2
distant salmon
#

While min(a,b) and max(a,b) is thing, you cant do sum(a,b) to add two numbers

#

Another frustrating thing about sum is that you have to tell it the start value. Which you really should need to have to do.

#

Had sum worked in the same way as min and max, then for example

sum([[1,2], [3,4]])

would just work straight out of the box

clear venture
#

Oh yeah that last part I agree with

#

Or like being able to pass a non-number to start and concatenating strings for example

distant salmon
#

sum is fundamentally not the right way to concatenate strings, and I don't think it is a good idea to make it call "".join for you

fleet bridge
#

!e ```py
_ = type('',(),dict(add=lambda a, b: b))()

print(sum([[1,2], [3,4]], start=))
print(sum(['a', 'b'], start=
))
print(sum([1, 2], start=_))

night quarryBOT
#

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

001 | [1, 2, 3, 4]
002 | ab
003 | 3
clear venture
#

I mean min and max just call > on the items they are given, I don't see why sum should be any different just calling +

distant salmon
fleet bridge
# distant salmon I don't know why sum works in a different way compared to min and max In a perfe...
# now sum has this signature: (i oversimplified it)
def sum(_i: Iterable[...], start: ... = 0) -> ...: ...

# if i understood correctly you want this:
def sum(_i: Iterable[...], default: ...) -> ...: ...
sum(['a', 'b']) == 'ab'
sum([[1, 2], [3, 4]]) == [1,2,3,4]
sum([1, 2]) == 3
sum([]) -> error
sum([], default=x) -> x

# and you also want this:
def sum(*_i: ..., default: ...) -> ...: ...
sum('a', 'b') == 'ab'
sum([1, 2], [3, 4]) == [1,2,3,4]
sum(1, 2) == 3
sum(*[]) -> error
sum(*[], default=x) -> x

#

i think that is possible, but that would be a huge breaking change right now

distant salmon
#

So sum([]) == 0

#

and sum() == 0

distant salmon
#

In 99% of cases it wouldn't break anything

fleet bridge
#

(just ignore the fact that im using strings, they are just convenient to show the behaviour)

distant salmon
versed eagle
#

same with max

#

i think that it should be all args or all inside one iterable

distant salmon
versed eagle
#

min(a,b,c) and min([a,b,c]) are the same

distant salmon
#

Oh. But that is simply how Python works currently

#

I and I find that to be very useful and easy to use in practice

versed eagle
#

but min(a) and min([a]) are NOT the same

versed eagle
fleet bridge
#
sum([1], [2], [3]) -> [1, 2, 3]
sum([1], [2]) -> [1, 2]
sum([1]) -> 1 or [1] ?
sum() -> 0
distant salmon
#

Logically it must be 1

versed eagle
#

min(it) and min(*it) are the same UNLESS it has one element

#

which is stupid and annoying

distant salmon
fleet bridge
#
MISSING = object()
def sum(*i, default=MISSING):
    if len(i) == 1 and hasattr(i[0], '__iter__'):
        i = i[0]
    i = list(i)
    if not i:
        if default is MISSING:
            raise ValueError('empty sequence with no default')
        else:
            return default
    res = i[0]
    for x in i[1:]:
        res += x
    return res

assert sum([1, 2]) == 3
assert sum([1]) == 1
assert sum(['a', 'b']) == 'ab'
assert sum(['a']) == 'a'
assert sum([], default=42) == 42

assert sum(1, 2) == 3
assert sum(1) == 1
assert sum('a', 'b') == 'ab'
assert sum('abc') == 'abc' # it is not just returning string, it splits it and constructs back from chars
assert sum(default=42) == 42

assert sum([1], [2], [3]) == [1, 2, 3]
assert sum([1], [2]) == [1, 2]
assert sum([1]) == 1
assert sum([], default=0) == 0
``` my quick and dirty implementation of what you want (but you have to pass default in order to use it)
versed eagle
#

im not saying that i dislike the idea as a whole, im saying that i dislike it that they are inconsistent

distant salmon
#

They either do min(a,b) or min(A)

distant salmon
#

Well you probably shouldn't

fleet bridge
#

i guess min(a, b) is the most popular use of min(*x) by far

#
>>> min('abc')
'a'
>>> min('abc', 'def')
'abc'
>>> min('abc', 'def', 'ghi')
'abc'
distant salmon
fleet bridge
#

yes, but min(A) doesnt use star-args feature

distant salmon
#

Ye I don't even recall ever seeing anyone use the star args feature with min

fleet bridge
#

im talking about cases where args are "unpacked" into min
min(a,b) is frequent, min(a,b,c) is a lot less frequent, min(*A) is weird

#

min(A) is totally ok

distant salmon
#

ye

#

Another thing I don't recall ever seeing is someone actually using the start variable in sum (for something other than 0/[]/...)

#

Even if I had wanted to have a non-zero start value, then I would probably still just do it like sum(A) + x instead

#

So start is pretty much a totally useless feature

fleet bridge
#

i guess if you are summing some non-int numbers (like Fraction or Decimal) you have to pass Fraction starting value

distant salmon
#

Well Python is ok with adding those

fleet bridge
#
>>> sum([F(1, 2), F(1, 3)])
Fraction(5, 6)
``` yeah
distant salmon
#

The modification that I'm suggesting for sum would only really break in cases like this

sum([[1,2], [3,4]], [5,6])
fleet bridge
#

so it will return [1,2,3,4] instead of [5,6,1,2,3,4] and return [5,6] iff input is empty, right?

distant salmon
#

Another scenario that would break is if someone uses start to change the type of the sum sum([1,2,3], 0.0)

wide crow
distant salmon
#

To make it work in the same way as min and max does

wide crow
#

But why?

vast wave
#

falsly in every scenario and somewhat makes sense

fleet bridge
#

huh? it doesnt solve the problem

vast wave
#

wrong message for some reason, i am confident i replied to the correct one

#

i meant the sum of nothing could return None, and it would make sense somewhat

fleet bridge
#

no, not really

distant salmon
#

Empty sums being 0 is simply the most natural definition

proper vault
#

Yeah, I think it is fine that sum is 0 by default, even if it is not a default that will work everywhere

#

There are languages like purescript, where zero is a polymorphic across everything that supports addition, but python is not one of those

grave rover
#

I never really stopped to think just how impressive PyLongObject is

fallow leaf
sick hound
#

why when you gonna to use the funcion print in a varibale to save characters the variable is always called I

for example

I=input
n = int(I())
h = I()
I(n,h)```
#

xd

#

is like something idiomatic ?

next flame
#

cuz input starts with i

#

so its easier to remember

#

but it doesn't really matter

quartz wave
versed eagle
#

in general, i prefer uppercased letters for aliases of builtins because that way im less likely to use them later for something else

fleet lintel
#

My golfed solution for this problem, too lazy to mess with the setup https://leetcode.com/problems/permutation-sequence/description/ py class Solution: def getPermutation(self, n: int, k: int) -> str: f=lambda x:0**x or x*f(x-1) l=lambda x,y:x and x.pop(((y-1)//f(len(x)-1))%len(x))+l(x,y)or"" return n<2 and"1"or l([*map(str,range(1,n+1))],k)

craggy hamlet
#

(credit to the solution i found that from)

fleet lintel
#

I would have done that, but I also wanted to be able to submit it with my lowly free rank. Also with the non-itertools.permuations style solutions will work for insanely large n, while anything above 10 causes the ones that use it to grind to a halt.

fleet lintel
#

Using permutations, the shortest would probably be something like py getPermutation=lambda self,n,k:"".join([*__import__("itertools").permutations(map(str,range(1,n+1)))][k-1])

vast wave
#

fully named self? cmon man

#

i love the python parser

fleet lintel
#

I think I understand what's happening. In the first case, print(1) is an annotation for lambda_, thus it gets "ignored" and you get lambda_ = 123. Thus for the second case, print(1) is an annotation for _, so it gets "ignored" and you just get lambda = 123, which is the syntax error.

vast wave
#

the first one is correct, print(1) is the type hint expression for a variable called lambda_

#

-> gets evaluated

#

second one is literally just a lambda that takes one unused parameter and prints 1

#

and i am trying to assign something to that lambda

oak anchor
#

eg. class_ will be a valid variable name in java and c++

versed eagle
#

whats the point of this

dapper cipher
#
print('hello world')
#

๐Ÿ˜Ž

unique heath
rocky pine
#

idk where to ask this but what is the best site to learn python for free?

sick hound
#

Anyone used poetry much? How does it compare with pipenv for dep management

arctic skiff
#

though i never used pipenv

night quarryBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

sick hound
#

ok guys just printed my first hello world program\

#

python looks pretty fun

#

!e

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

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

hello world
karmic pumice
#

ehh the only interesting thing is using function argcount

sick hound
#

just simple python nothing crazy ๐Ÿ˜Š

karmic pumice
#

the last ones are basically for creating integers

#

eq to range(1,8)

fleet bridge
#

(open it in full size)

cloud fossil
#

Is it a fractal or something

fleet bridge
#
for all rational numbers a/b from 0 to 1:
  draw (a/b, b)
#
import functools
import itertools

N = 720 # screen size
MAX_DEN = N

@functools.cache
def rats(n: int) -> list[tuple[int, int]]:
    r = []
    if n == 0:
        r.append((0, 1))
        r.append((1, 1))
        return r

    p = iter(rats(n - 1))
    a, b = next(p)
    r.append((a, b))
    for c, d in p:
        if b + d < MAX_DEN: # ignore all rationals with too big denom
            r.append((a + c, b + d))
        r.append((c, d))
        a, b = c, d
    return r


import pygame as pg

pg.init()
s = pg.display.set_mode((N + 1, N + 1))
s.fill((0, 0, 0))
for d in itertools.count(): # draw more and more every time, inefficient!
    for a, b in rats(d):
        s.set_at(
            (N * a / b, b - 1),
            (255, 255, 255),
        )
    pg.display.flip()

    for e in pg.event.get():
        if e.type == pg.QUIT:
            pg.quit()
            1/0

#

number 1/100 will appear in 100th Farey sequence, but n-th Farey sequence contains 2^n+1 numbers, so generating all 100th sequence is not possible
that is why im ignoring all rationals with denominator bigger than some fixed number (in this case - screen size)
but my algo is definitely not optimal, it degrades to O((number of all rats with denoms < N)^2) complexity, which is pretty slow

fleet bridge
#

simple FIFO queue: ```py
l = [...]

get = iter(l).next
put = l.append

unique heath
# sick hound !e ```py (lambda i: [print(chr(x),end='') for x in (lambda i=i: [globals().updat...

!e absolute rookie

print(__builtins__.__getattribute__(__builtins__.__dir__().__getitem__(__builtins__.__dir__().__len__().__floordiv__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__()).__add__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__()).__add__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__()).__add__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__()))))).__add__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__())).__add__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__())).__add__(__builtins__.__dir__().__len__().__floordiv__(__name__.__dir__().__len__())))))
``` this is just the print function lmao
night quarryBOT
#

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

<built-in function print>
orchid glen
#

code golfing anyone?

clear venture
orchid glen
#

uh

#

hm

#

what do code golfers enjoy golfing

unique heath
orchid glen
#

erm

#

ok

quartz wave
orchid glen
#

wow

#

brilliant

quartz wave
#

python

     ๐ŸŒ๏ธโ€โ™‚๏ธ
gleaming linden
#

why do we have a spinning pride python emoji but not a spinning normal python emoji

sick hound
#

friend sent me this funny way of obfuscating/confusing your python code to make it harder to read

__________ = eval(getattr(__import__(bytes([98, 97, 115, 101, 54, 52]).decode()), bytes([98, 54, 52, 100, 101, 99, 111, 100, 101]).decode())(bytes([90, 88, 90, 104, 98, 65, 61, 61])).decode());___________ = __________(getattr(__import__(bytes([98, 97, 115, 101, 54, 52]).decode()), bytes([98, 54, 52, 100, 101, 99, 111, 100, 101]).decode())(bytes([90, 50, 86, 48, 89, 88, 82, 48, 99, 103, 61, 61])).decode());_______________ = __________(getattr(__import__(bytes([98, 97, 115, 101, 54, 52]).decode()), bytes([98, 54, 52, 100, 101, 99, 111, 100, 101]).decode())(bytes([88, 49, 57, 112, 98, 88, 66, 118, 99, 110, 82, 102, 88, 119, 61, 61])).decode());________________ = __________(getattr(__import__(bytes([98, 97, 115, 101, 54, 52]).decode()), bytes([98, 54, 52, 100, 101, 99, 111, 100, 101]).decode())(bytes([89, 110, 108, 48, 90, 88, 77, 61])).decode())
#

!e

__________ = eval(getattr(__import__(bytes([98, 97, 115, 101, 54, 52]).decode()), bytes([98, 54, 52, 100, 101, 99, 111, 100, 101]).decode())(bytes([90, 88, 90, 104, 98, 65, 61, 61])).decode());___________ = __________(getattr(__import__(bytes([98, 97, 115, 101, 54, 52]).decode()), bytes([98, 54, 52, 100, 101, 99, 111, 100, 101]).decode())(bytes([90, 50, 86, 48, 89, 88, 82, 48, 99, 103, 61, 61])).decode());_______________ = __________(getattr(__import__(bytes([98, 97, 115, 101, 54, 52]).decode()), bytes([98, 54, 52, 100, 101, 99, 111, 100, 101]).decode())(bytes([88, 49, 57, 112, 98, 88, 66, 118, 99, 110, 82, 102, 88, 119, 61, 61])).decode());________________ = __________(getattr(__import__(bytes([98, 97, 115, 101, 54, 52]).decode()), bytes([98, 54, 52, 100, 101, 99, 111, 100, 101]).decode())(bytes([89, 110, 108, 48, 90, 88, 77, 61])).decode())
night quarryBOT
#

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

[No output]
low lynx
#

that's also really easy to deobfuscate

last locust
#

This was my (admittedly somewhat lazy) attempt at an obfuscator/deobfuscator a few years back (works in 3.9, but not 3.10+ since it relies on orderings of __dir__ for various modules)

#

Basically just maps every letter in the code to an obfuscated thing that execs to it

#

I was going to change it to not rely on __dir__ so that it'd work on more versions but never bothered in the end

long fulcrum
#

can this be golfed any further?

o=range(1,10000)
for i in o:sum(x:=[j for j in o if i%j<1])%len(x)<1==print(i)```
gleaming linden
#

!e ```py
o=range(1,10000)
for i in o:sum(x:=[j for j in o if i%j<1])%len(x)<1==print(i)

night quarryBOT
gleaming linden
long fulcrum
#

prints numbers from 1-10k if the mean of their divisors is an integer

gleaming linden
#

<1== -> or

long fulcrum
#

huh

#

why does that work

gleaming linden
#

that's just how or works

#

it short-circuits after the first truthy value

#

so if sum(...)%len(x) was nonzero it wouldn't print

orchid nymph
long fulcrum
#

is it very different from my solution?

orchid nymph
#

no 2 little tricks

distant salmon
#

They set a very unfortunate timelimit for that problem

orchid nymph
orchid nymph
#

the length of x is not the same

distant salmon
#

oh

fleet bridge
#

!e ```py
def foo(x:lambda: print("foo")()):
print("foo",x)

foo(1)
print(callable(foo.annotations['x']))
print(foo.annotations'x')```

night quarryBOT
#

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

001 | foo 1
002 | True
003 | foo
004 | Traceback (most recent call last):
005 |   File "/home/main.py", line 6, in <module>
006 |     print(foo.__annotations__['x']())
007 |           ^^^^^^^^^^^^^^^^^^^^^^^^^^
008 |   File "/home/main.py", line 1, in <lambda>
009 |     def foo(x:lambda: print("foo")()):
010 |                       ^^^^^^^^^^^^^^
011 | TypeError: 'NoneType' object is not callable
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/GIQ22ZAG32QQDA6Q45CY46Y7DY

versed eagle
#

you try to call the result of print

#

print returns None, which isn't callable

restive void
#

!e

def foo(x:lambda: print("foo")):
    print("foo",x)
   
foo(1)
print(callable(foo.__annotations__['x']))
print(foo.__annotations__['x']())
night quarryBOT
#

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

001 | foo 1
002 | True
003 | foo
004 | None
orchid nymph
#

!e

def foo(x:(lambda: print("foo"))()):
    print("foo",x)
night quarryBOT
#

@orchid nymph :white_check_mark: Your 3.12 eval job has completed with return code 0.

foo
orchid nymph
#

!e

def foo(x:lambda: print("foo")):
    print("foo",x)
foo.__annotations__['x']()
night quarryBOT
#

@orchid nymph :white_check_mark: Your 3.12 eval job has completed with return code 0.

foo
orchid nymph
#

!e

n=0
type F=exec("n.bit_count()%2 or print(n);n+=1;n<16!=F.__value__",globals())
F.__value__
night quarryBOT
#

@orchid nymph :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | 0
002 | 3
003 | 5
004 | 6
005 | 9
006 | 10
007 | 12
008 | 15
karmic pumice
#

lmao

fleet bridge
#

lmao

#

that's cool

versed eagle
lunar marsh
cloud fossil
#

Can anyone get something more performant than

lambda l: sum(map(lambda x, times: (x,) * times, l, map(lambda x: (not x) + 1, l)), ())[:len(l)]

which does the same thing?
With timeit.timeit I measure around 2.45 seconds for l = 0, 0, 1, 2, 0, 3, 4, 5
It doesn't matter what specific sequence l is, probably, nor does it matter what the resulting object's sequence type is

nocturne spruce
#

!e

night quarryBOT
#
Missing required argument

code

#
Command Help

!eval [python_version] <code, ...>
Can also use: e

Run Python code and get the results.

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

The starting working directory /home, is a writeable temporary file system. Files created, excluding names with leading underscores, will be uploaded in the response.

If multiple codeblocks are in a message, all of them will be joined and evaluated, ignoring the text outside them.

Currently only 3.12 version is supported.

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

nocturne spruce
#

!e print(
sum(["a", "b"], type("", (), {"add":"".add})())
)

night quarryBOT
#

@nocturne spruce :white_check_mark: Your 3.12 eval job has completed with return code 0.

ab
cloud fossil
oak anchor
#

!e

__chr__ = __builtins__.__getattribute__(__name__.__reduce__.__name__[(__name__.__len__() // __name__.__len__()) + (__name__.__len__() // __name__.__len__()) + (__name__.__len__() // __name__.__len__()) + (__name__.__len__() // __name__.__len__()) + (__name__.__len__() // __name__.__len__()) + (__name__.__len__() // __name__.__len__())] + __name__.__add__.__class__.__name__[(__name__.__len__() // __name__.__len__()) + (__name__.__len__() // __name__.__len__()) + (__name__.__len__() // __name__.__len__())] + __name__.__class__.__name__[-(__name__.__len__() // __name__.__len__())])

__import__(__chr__((__name__.__len__())*(__name__.__len__()) + (__name__.__len__()) + (__name__.__len__()) + (__name__.__len__()) + (__name__.__len__()) + (__name__.__len__()) + (__name__.__len__()) + (__name__.__len__() // __name__.__len__()) + (__name__.__len__() // __name__.__len__()) + (__name__.__len__() // __name__.__len__()) + (__name__.__len__() // __name__.__len__())) + __chr__((__name__.__len__())*(__name__.__len__()) + (__name__.__len__()) + (__name__.__len__()) + (__name__.__len__()) + (__name__.__len__()) + (__name__.__len__())) + __chr__((__name__.__len__())*(__name__.__len__()) + (__name__.__len__()) + (__name__.__len__()) + (__name__.__len__()) + (__name__.__len__()) + (__name__.__len__()) + (__name__.__len__() // __name__.__len__())) + __chr__((__name__.__len__())*(__name__.__len__()) + (__name__.__len__()) + (__name__.__len__()) + (__name__.__len__()) + (__name__.__len__()) + (__name__.__len__()) + (__name__.__len__()) + (__name__.__len__() // __name__.__len__()) + (__name__.__len__() // __name__.__len__()) + (__name__.__len__() // __name__.__len__())))
night quarryBOT
#

@oak anchor :white_check_mark: Your 3.12 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/PKI6SPR7BQSRG2U35CPFO7YVJY

oak anchor
#

I'd love to replace all the operators with dunders as well but discord won't let me post a message that big

versed eagle
#

they added more typehinting stuff

oak anchor
versed eagle
#

code that uses it will be easier on the eyes than it was before
what's easiest on the eyes is just none of it at all

if you don't like it don't use it
that'd be all well and good if i existed in a vacuum with no one else, but i dont. other people are going to use it, and im going to have to deal with it

versed eagle
oak anchor
#

if you didn't care about XML files you wouldn't go out and say the xml module is pointless nonsense, why this

#

about other people using it, would you rather see

class Foo(Generic[T]):

or

class Foo[T]:
#

i think you'll get used to option 2 pretty quickly if that's the only two options

versed eagle
#
  1. xml handling doesn't result in changes to the core language
  2. xml has a much better noise to signal ratio than typehinting
oak anchor
#

as for if ideally you'd rather see none of it at all, unfortunately it's useful to some and indeed we don't live in a vacuum

versed eagle
#

typehinting got beyond the point of practical usefulness a while ago

oak anchor
#

pep695 decreases noise that's kinda the entire point

#

if it had gone beyond i doubt its usage would be going up

versed eagle
#

meaning there will be more noise overall

oak anchor
#

more people are using it regardless

versed eagle
#

no? without it the same number of people would be using it

#

something can't be more than itself

oak anchor
#

..

#

over time.

versed eagle
#

that's irrelevant

#

to what im saying

oak anchor
#

I'll leave this here

fleet bridge
grave grail
#

I am challenging if anyone could understand this:

lambda x,y: ''.join([{0: [' '],2:['A','B','C'],3:['D','E','F'],4:['G','H','I'],5:['J','K','L'],6:['M','N','O'],7:['P','Q','R','S'],8:['T','U','V'],9:['W','X','Y','Z']}[d[1]][([(i,b[0]) for i,b in enumerate(zip(x,y)) if i==0 or b[0]!=x[i-1] or b[1]>y[i-1]+0.5] + [(len(x), )])[i+1][0]-d[0]-1] for i,d in enumerate([(i,b[0]) for i,b in enumerate(zip(x,y)) if i==0 or b[0]!=x[i-1] or b[1]>y[i-1]+0.5])])
grave grail
#

How do I stop it from actually pinging people but still show the username

karmic pumice
#

escape the @ probally

#

i dont care about pings anyway

grave grail
#

It just instantly convert to <@id> lmao

karmic pumice
#

cereal is usually good at uncompressing those kinds of stuff

grave grail
#

Ok lol

karmic pumice
#

you wrote this right

grave grail
#

Yeah

#

And also good luck decompressing since I straight away build this from one linear with just a few semi-colon

#

And a global variable that I now throw inside the function(which is quite obviously which is)

karmic pumice
#

yeah this is exactly like a telephone keypad but i struggle to understand the input/output relation

grave grail
#

And now they are referenced 4 and 3 times for each

karmic pumice
#
f([3],[any_ascii_char])=='D'

?

#

thats uhh something
even if i give an int its still 'D'

grave grail
#

f([3],[0]) == 'D'

#

If you do execute it

#

If I didn't code it wrong

karmic pumice
#

f([3],(anything)) seems to be 'D'

grave grail
#

Well, not anything