#esoteric-python

1 messages · Page 39 of 1

versed eagle
#

and maybe a -v | --verbose

#

should probably have options to handle different output codecs

#

we might want to output in EBCDIC

#

etc.

#

and it would be nice to be able to read options from a file

fleet bridge
#

-o FILENAME / --output FILENAME would be nice

versed eagle
#

ooo true

#

... if we're doing -o | --output for stdout we should probably have a -i | --input for stdin
just so that it matches

#

oh and there should be an option for the output to be gzipped

rugged sparrow
#

It should also be possible to output a few different formats, pdfs, png, etc

#

For completeness lmao

versed eagle
#

pdf would be nice

#

latex output would be good

earnest wing
#

of course, logging and warnings

versed eagle
fleet bridge
#

btw seperator should be separator if im not crazy

#

add runtime type checks, because we cant trust type annotations

fleet bridge
earnest wing
#

unit tests

fleet bridge
#

add possibility to print hello world in different formats: ```
Hello, world!
Hello, world
hello, World
hello, world
hello world
hello_world
helloworld

add options for other languages like `--lang=en` or `--lang=ru`
restive void
#

Also, it should of course look at config files in various locations

fleet bridge
#

you probably should catch other exceptions, not only BaseException
for example, you can print something to stderr if stdout died for some reason

restive void
#

.config/helloworldrc, .helloworldrc, and falling back to the system-wide /etc/helloworldrc

fleet bridge
#

there is no error handling outside of main() in if __name__ code - we cant be sure that main() doesnt throw anything

restive void
#

(come to think of it, these should probably be yaml files)

fleet bridge
#

add option to enable colored output (and also look at envvars to determine if colors are available)

#

if you decided to use from __future__ import print_function, then consider using u prefix for strings: u"Hello, world!" instead of "Hello, world!"

fleet lintel
#

I wonder how many different data file encodings you could possibly stuff into one file, for maximum parse redundancy. also remember to throw in an ast.literal_eval

versed eagle
versed eagle
#

it should use the XDG Base Directory Specification

#

specifically it should use the environment variables $XDG_CONFIG_HOME and $XDG_CONFIG_DIRS

#

but it needs to fall back to $HOME/.config and /etc/xdg respectively if those variables are unset or empty

quartz wave
#

i don't know what to test this with but here's 117b ```py
import sys
for s in sys.argv[1:]:b=1;print(s+(str(j:=sum(int(c)(b:=b+1)for c in s.replace("-",""))%11))(j>9)or"X"))

#

109b ```py
import sys
for s in sys.argv[1:]:b=1;print(s+(str(j:=sum(int(c)(b:=b+1)for c in s if'-'<c)%11))(j>9)or"X"))

restive void
#

Calling it with 123456789 987654321 as arguments should print

123456789X
9876543210
#

Fixed your code though, still 109 bytes:

import sys
for s in sys.argv[1:]:b=0;print(s+(str(j:=sum(int(c)*(b:=b+1)for c in s if'-'<c)%11)*(j<=9)or"X"))
quartz wave
#

why not do <10 (108 bytes) ```py
import sys
for s in sys.argv[1:]:b=0;print(s+(str(j:=sum(int(c)(b:=b+1)for c in s if'-'<c)%11)(j<10)or"X"))

restive void
quartz wave
#

oh yeah

#

i forgot how to count

dense mural
#
>>> x=list(range(5))
>>> for x[-1] in x:
...     print(x, x[-1])
...
[0, 1, 2, 3, 0] 0
[0, 1, 2, 3, 1] 1
[0, 1, 2, 3, 2] 2
[0, 1, 2, 3, 3] 3
[0, 1, 2, 3, 3] 3

💦

#

This Feels So Cursed

silent vale
# dense mural This Feels So Cursed

[print(*row) for row in list(zip(*list(permutations({"V", "L", "R", "G"}))))] nah, this is cursed, it gets the permutations of the pinouts of a 4 pole 3.5mm jack to component AV connector, transposes them, and prints them out, all in one line haha

#

well,, ignoring the line you need to import itertools.permutations atleast

dense mural
#

Yeah, No... That's Like Most Normal Python Code
If You Had Done It Without Import Then Yes

silent vale
#

tfym normal haha

#

that list comprehension is crying its eyes out

restive void
#

You can remove both calls to list()

silent vale
#

tru,, that was a relic of my debugging before i made it into a oneliner

bright valve
#

my brain just exploded

dense mural
#

Btw print In List Comprehension? Bruh

#

for row in list(zip(*list(permutations({"V", "L", "R", "G"})))): print(*row)?

silent vale
#

yeah, less characters in a list comp

dense mural
#

To Golf It: for row in list(zip(*list(__import__('itertools').permutations({"V", "L", "R", "G"})))): print(*row)

silent vale
dense mural
#

True, But Isnt That More Memory Used?

silent vale
#

not if u print it i think, bcs its just storing Nones

#

could be wrong thou

dense mural
#

Yes, print Doesnt Return Anything So Its None, But [None] * n < 0

#

I Think

#

Correct Me If Im Wrong 😅

silent vale
#

i would assume it optimizes the Nones out, since, atleast if ur not using ipython, its not storing it anywhere??

fleet lintel
#

Permutations not permutations, product for even longer. I used it to generate a 33k char long regex for AoC day 3 #1180738420272799814 message

silent vale
#

lmfao

restive void
finite summit
#

ey guys, i just made a badass code obfuscator, for now it does stuff like this, i am working on all the cool thingys, such as 1 liners and stuff

#

i am working on it, i'll post the project here after i finish it so you guys can take a look

grave grail
#

A helpful feature, Find and replace 🙂

dense mural
gleaming linden
# silent vale isnt it?

*map(print,iterable), is another option, but it won't work here because you need to unpack as well

unique heath
versed eagle
fleet bridge
#
import itertools as x;x.permutations
__import__('itertools').permutations
gleaming linden
#
import itertools as x;x.permutations
__import__('itertools').permutations
from itertools import*;permutations
unique heath
#

chat seems pretty dead

quartz wave
#

i still have soo much things to fix

long fulcrum
#

golf this more?

import sys
for i in sys.argv[1:]:
    j=0;f=.1
    while f%1:exec("j+=1;f=j*"+i)
    print(f"{int(f)}/{j}")```
#

reduces argument a/b to its simplest form

earnest wing
#

unpacking into a set

long fulcrum
#

the docs show all you can do

hidden lava
#

it works for a pc to another but when i try to make it as an apk to use it in my phone it's not working.
i'm using python(kivy, paramiko). please help me!
i don't understand i puted .spec files with requirements: python3, kivy, paramiko
https://github.com/herzSaifElarbi/pcController.git

GitHub

creating a phone application to control my pc using python lib(kivy, paramiko), i hope i will enjoy this! - GitHub - herzSaifElarbi/pcController: creating a phone application to control my pc usin...

versed eagle
quartz wave
#

wait

digital mesa
#

!e

from types import SimpleNamespace
n = n.v = n.e = n.a = n.y = n.g = n.p = n.o = n.r = n.u = n.i = n.n = n._ = SimpleNamespace()
print(n.e.v.e.r._.g.o.n.n.a._.g.i.v.e._.y.o.u._.u.p is n)
night quarryBOT
#

@digital mesa :white_check_mark: Your 3.12 eval job has completed with return code 0.

True
digital mesa
unique heath
#
from types import SimpleNamespace
n = n.v = n.e = n.a = n.y = n.g = n.p = n.o = n.r = n.u = n.i = n.n = n.l = n.t = n.d = n.w = n._ = SimpleNamespace()
print(bool(n.e.v.e.r._.g.o.n.n.a._.g.i.v.e._.y.o.u._.u.p and n.e.v.e.r._.g.o.n.n.a._.l.e.t._.y.o.u._.d.o.w.n))```
digital mesa
#

glad to inspire

quartz wave
#

forgot to eval

#

!e ```py
from types import SimpleNamespace
n = n.v = n.e = n.a = n.y = n.g = n.p = n.o = n.r = n.u = n.i = n.n = n.l = n.t = n.d = n.w = n.ᅠ= SimpleNamespace()
print(bool(n.e.v.e.r.ᅠ.g.o.n.n.a.ᅠ.g.i.v.e.ᅠ.y.o.u.ᅠ.u.p and n.e.v.e.r.ᅠ.g.o.n.n.a.ᅠ.l.e.t.ᅠ.y.o.u.ᅠ.d.o.w.n))

night quarryBOT
#

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

True
digital mesa
#

wiat wut, double dot?

#

didn't know that works

unique heath
#

!e

from types import SimpleNamespace
n = n.v = n.e = n.a = n.y = n.g = n.p = n.o = n.r = n.u = n.i = n.n = n.l = n.t = n.d = n.w = n.ᅠ= SimpleNamespace()
am_i_gonna = bool
print(am_i_gonna(n.e.v.e.r.ᅠ.g.o.n.n.a.ᅠ.g.i.v.e.ᅠ.y.o.u.ᅠ.u.p and n.e.v.e.r.ᅠ.g.o.n.n.a.ᅠ.l.e.t.ᅠ.y.o.u.ᅠ.d.o.w.n))```
night quarryBOT
#

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

True
digital mesa
#

using a character that looks like space

quartz wave
#

!e ```py
from types import SimpleNamespace
n = n.v = n.e = n.a = n.y = n.g = n.p = n.o = n.r = n.u = n.i = n.n = n.l = n.t = n.d = n.w = n.rᅠg = n.aᅠg = n.eᅠy = n.uᅠu = n.aᅠl = n.tᅠy = n.uᅠd = SimpleNamespace()
amᅠiᅠgonna = bool
print(amᅠiᅠgonna(n.e.v.e.rᅠg.o.n.n.aᅠg.i.v.eᅠy.o.uᅠu.p and n.e.v.e.rᅠg.o.n.n.aᅠl.e.tᅠy.o.uᅠd.o.w.n))

night quarryBOT
#

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

True
digital mesa
#

I'm gonna never gonna?

#

smh

quartz wave
#

lm

#

ao

unique heath
digital mesa
#

Silly doge

quartz wave
#

!e ```py
neverᅠgonnaᅠgiveᅠyouᅠup = neverᅠgonnaᅠletᅠyouᅠdown = neverᅠgonnaᅠrunᅠaround = desertᅠyou = True
print(neverᅠgonnaᅠgiveᅠyouᅠup, neverᅠgonnaᅠletᅠyouᅠdown, neverᅠgonnaᅠrunᅠaround and desertᅠyou)

night quarryBOT
#

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

True True True
digital mesa
#

amazing

unique heath
#

lmao

arctic skiff
arctic skiff
#

ok

#

that gave me a idea

unique heath
#

0o no

digital mesa
#

pls don't be the same idea I've been working on

unique heath
#

i feel like we all know the idea

digital mesa
#

I have a working copy of my idea but idk if I should take the time to make it better...

unique heath
#

the esopy hive mind

digital mesa
#

I'll just post it so I can be first in case it's the same idea as someone else

#

!e

class Zen(int):
    def __getattr__(self, *_):
        return self

Beautifulᅠisᅠbetterᅠthanᅠugly = refuseᅠtheᅠtemptationᅠtoᅠguess = andᅠpreferablyᅠonlyᅠone = obviousᅠwayᅠtoᅠdoᅠit = right = now = itᅠisᅠaᅠbadᅠidea = itᅠmayᅠbeᅠaᅠgoodᅠidea = letᅠusᅠdoᅠmoreᅠofᅠthose = Zen()

(
    Beautifulᅠisᅠbetterᅠthanᅠugly.
    Explicitᅠisᅠbetterᅠthanᅠimplicit.
    Simpleᅠisᅠbetterᅠthanᅠcomplex.
    Complexᅠisᅠbetterᅠthanᅠcomplicated.
    Flatᅠisᅠbetterᅠthanᅠnested.
    Sparseᅠisᅠbetterᅠthanᅠdense.
    Readabilityᅠcounts.
    Specialᅠcasesᅠareᅠnotᅠspecialᅠenoughᅠtoᅠbreakᅠtheᅠrules.
    Althoughᅠpracticalityᅠbeatsᅠpurity.
    Errorsᅠshouldᅠneverᅠpassᅠsilently.
    Unlessᅠexplicitlyᅠsilenced.
    Inᅠtheᅠfaceᅠofᅠambiguity, refuseᅠtheᅠtemptationᅠtoᅠguess.
    Thereᅠshouldᅠbeᅠone-- andᅠpreferablyᅠonlyᅠone --obviousᅠwayᅠtoᅠdoᅠit.
    AlthoughᅠthatᅠwayᅠmayᅠnotᅠbeᅠobviousᅠatᅠfirstᅠunlessᅠyouᅠareᅠDutch.
    Nowᅠisᅠbetterᅠthanᅠnever.
    Althoughᅠneverᅠisᅠoftenᅠbetterᅠthan *right* now.
    Ifᅠtheᅠimplementationᅠisᅠhardᅠtoᅠexplain, itᅠisᅠaᅠbadᅠidea.
    Ifᅠtheᅠimplementationᅠisᅠeasyᅠtoᅠexplain, itᅠmayᅠbeᅠaᅠgoodᅠidea.
    Namespacesᅠareᅠoneᅠhonkingᅠgreatᅠidea -- letᅠusᅠdoᅠmoreᅠofᅠthose.ᅠ
)
night quarryBOT
#

@digital mesa :warning: Your 3.12 eval job has completed with return code 0.

[No output]
digital mesa
#

I realized that I could've made all those is s and the and work normally, by defining more variables

digital mesa
unique heath
digital mesa
#

ok well now I'm wondering what your idea is

unique heath
#

replacing all _ with the funny space

digital mesa
#

oh

#

~~boring 😛 ~~

hollow moth
#
image = \
        \
        \
        \
        \
        pygame.transform.scale(image, (30,30))
``` 👍
arctic skiff
#

a poem?

arctic skiff
digital mesa
#

!pep 20

night quarryBOT
arctic skiff
#

ok

sick hound
quartz wave
long fulcrum
fervent elbow
#

!pep 18

night quarryBOT
#
PEP not found

PEP 18 does not exist.

fervent elbow
#

!pep 8

night quarryBOT
fervent elbow
arctic skiff
#

pep 8 is illigal in this channel

versed eagle
#

it's possible to follow pep 8 and still be esoteric

fleet bridge
finite summit
#

what you guys think? i am still working on the obfuscation of code, just added random comments in random lines

versed eagle
finite summit
#

i mean, i am doing a program to do all of that

finite summit
#

for now, it just changes variable names, functions, classes, and params + adds comments

fleet bridge
#

does it remove comments?

finite summit
#

not yet, i will add it in the next update tho, i am working on adding random if statements

finite summit
#

now it removes them!

line_without_comments = re.sub(r'#.*', '', line)

that funny line removes them for every single line

versed eagle
#
print("""
# <- that shouldn't be removed """)
finite summit
#

i did not let me fix that real quick

#

got it

#
Input:
  a = "#Zxc"
  print(a) #zxcased
Output:
  # Why was this done this way? line 122
  IOO0OOO0O00OO00O0O0 = "#Zxc"
  print(IOO0OOO0O00OO00O0O0)
fleet bridge
#

IMO the easiest way to remove comments is to code=ast.unparse(ast.parse(code))

proper vault
#

I wonder if you could do some fancy NLP to make the names refer to a correct-seeming wrong name, rather than just a clearly meaningless one.

fleet bridge
#

you can just shuffle all names from code with each other

#

so fib(n) becomes n(fib)

proper vault
#

I wonder how that would look

finite summit
#

for now this is the function that gets the names

#

it doesnt even take account of how many vars, funcs, etc, that are in the program, and it computes literally all the possibilities with those letters, based on the obfus_chars number

#

it is so bad, i know ahahahah

finite summit
sick hound
#

the IO0O0O shit

finite summit
#

it just changes variables names and takes off comments

finite summit
# proper vault I wonder if you could do some fancy NLP to make the names refer to a correct-see...

I will try to use chatgpt api, taking inspiration by this vid https://www.youtube.com/watch?v=vOkp2PN2S6Q&t=498s

In this project, I employed the use of AI to create a minion twitch streamer that interacts with chat and the game. This project took me about a week to fully create, 3 days of coding and 4 days of editing/gathering footage. I hope you guys all enjoy, the github will be below if you want a look at the code or want to try it out yourself (of cour...

▶ Play video
finite summit
# sick hound i've seen this exact obfuscator online somewhere

it can take any form it is not that bad,

# Placeholder comment  line 112
class IeeSe:

# TODO: Review this later  line 178
    def __init__(ISMSM, ISMMe, IMMMS):
        ISMSM.ISMMe = ISMMe
# This might need refactoring  line 224
        ISMSM.IMMMS = IMMMS

# Placeholder comment  line 112
    def ISMeS(ISMSM):
        return 'I am an animal named ' + ISMSM.ISMMe

class IMSMe(IeeSe):

    def __init__(ISMSM, ISMMe, IMMMS, IeeMe):
        super().__init__(ISMMe, IMMMS)
# This part is crucial  line 32
        ISMSM.IeeMe = IeeMe

    def ISMeS(ISMSM):
# This part is crucial  line 32
        return 'Woof! My ISMMe is ' + ISMSM.ISMMe

def IeMMe():
    IMMMe = IMSMe('Rex', 5, 'Golden Retriever')
    print(IMMMe.ISMeS())
    IMeeM = [1, 2, 3, 4, 5]
    IMSMM = sum(IMeeM)
    print('Total:', IMSMM)
    for num in IMeeM:
# Placeholder comment  line 112
        if num % 2 == 0:
            print(num, 'is even')
# This part is crucial  line 32
        else:
            print(num, 'is odd')
    ISMMe = 'Charlie'
# Be careful with this part  line 1
    IMMMS = 3
    ISSSe = IeeSe(ISMMe, IMMMS)
# Magic happens here  line 4
    print(ISSSe.ISMeS())
# This might need refactoring  line 224
if __name__ == '__main__':
    IeMMe()
sick hound
#

you should try to obfuscate the strings next

#

is this intended btw

finite summit
#

it is not, uhu ;-;

#

i will correct that tomorrow, i wanna cry ahahaha

sick hound
finite summit
#

i just wanna experiment

sick hound
#

best of luck with all your testing

finite summit
#

looks sick tbh

unique heath
finite summit
#

it is basically a 1 to 1, transformation, each letter of a string is given a color, and it loops throught the letter putting a pixel on the screen.

#

if you read it in reverse, you'll get the whole string

finite summit
versed eagle
unique heath
#

compreshun

finite summit
#

ill keep working on It tomorrow, now i sleep gn everybody

fleet bridge
#

i wish f-strings were the default mode

versed eagle
versed eagle
unique heath
#

that would be a breaking change tho

versed eagle
#

Admittedly, this change would be more breaking than most, but it certainly wouldn't be the only breaking change.

digital mesa
# fleet bridge i wish f-strings were the default mode

introducing s-strings, the new way to write curly braces in your strings! What does the "s" stand for, you ask? It stands for string! Say hello to your new friend, string-strings!

print(s"{No interpolation whatsoever!}")
fleet bridge
#

btw you can use {{ inside f-strings to make {

digital mesa
#

yep

fleet bridge
#

so this should work: ```py
print("{{No interpolation whatsoever!}}")

digital mesa
#

but did you consider... s-strings? 🫂

fleet bridge
#

lets also add fs-strings, that will enable f-string formatting in s-strings!

rugged sparrow
digital mesa
#

those are with single backticks

rugged sparrow
#

i was trying to wrap the backtick with formatting like a but discord did not like it

fleet bridge
#

```

#

uh

fleet bridge
#

#

close enough

#

digital mesa
#

not the "front tick" 💀

fleet bridge
#

́

#

̀

#

̀ ̀ ̀

wheat river
#

fleet bridge
#

̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀

wheat river
#

!charinfo `

night quarryBOT
fleet bridge
#

!charinfo ̀

night quarryBOT
digital mesa
#

#

so wide

digital mesa
#

```py
print⦅"Hello, world!"⦆
```

#

cursed full width

wheat river
#

`

fleet bridge
#

̀̀̀

#

̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀

wheat river
fleet bridge
#

̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀ ̀

#

what is going on

#

for me it looks like this

fleet bridge
wheat river
#

Works then ig

wheat river
night quarryBOT
#
Missing required argument

message

#
Command Help

!raw <message>
Shows information about the raw API response.

Subcommands:

!raw json <message>
Shows information about the raw API response in a copy-pasteable Python format.

wheat river
#

Ah rip

fleet bridge
night quarryBOT
#

You are not allowed to use that command here. Please use the #bot-commands channel instead.

wheat river
night quarryBOT
#
== Raw message ==

`​`​ `​ `​`​
fleet bridge
#

this is how this message looks when i copied it

wheat river
#

Ah

#

Discord moment

fleet bridge
night quarryBOT
#

@timber grotto :white_check_mark: Your 3.12 eval job has completed with return code 0.

HELLO
quartz wave
#

ran my renamer on it ```py
from inspect import currentframe as A
B, C, D, E, F, G, H = (True, False, chr, len, next, str, print)
H(*(D((B << 6) + E(F((I for I, J in A().f_globals.items() if J == K)))) for K in (E, H, 0, 0, 1)), sep=G())

#

i think it only works with those names

serene stratus
#

@quartz wave does your renamer handle attributes of custom classes?

quartz wave
serene stratus
serene stratus
#

Sadge that's the part I always struggled with so I hoped to gain some insights 😄

quartz wave
#

it keeps attributes untouched unless they're from a constant

serene stratus
#

if you want a challenge you should try supporting that

#

it gets even more complicated when you try to add multi file support so then you need to see which import is from an external dependency or a local file

quartz wave
#

like someone could do this ```py
class A:
t = 5

exec("class A: pass")

A.t # ?

serene stratus
#

yeah you have to set some kind of standards for your users, like the use of exec is not supported by the renamer/obfuscator

#

I guess when you're using the renamer to rename obfuscated files you can't set those kinds of standards

quartz wave
#

i think i tried to add special handling to if-else ternaries where walrus assignments are done

serene stratus
#

what would be the ideal way to know if a class/instance of a class is local or from an external dep

#

you'd have to build some kind of small interpreter/emulator to follow the types in the code

#

kind of like how pytype works as well

quartz wave
#

yes

#

but a simple AST checker can't figure that out

#

and even if an exec() call was analyzed i don't think just the name exec would be used

serene stratus
#

yeah the parameter to exec could also be generated dynamically so it's not possible

languid hare
#

you can do a similar trick à la the halting problem

#
class A:
  if not thinks_has_t_attribute(__file__):
    t = 0

A.t # If I think it does, it doesn't. If I think it doesn't, it does.
#

In computability theory, Rice's theorem states that all non-trivial semantic properties of programs are undecidable. A semantic property is one about the program's behavior (for instance, does the program terminate for all inputs), unlike a syntactic property (for instance, does the program contain an if-then-else statement). A property is non-t...

grizzled cape
#

I think I've created the worlds fastest is_even program. Its even multithreaded 🤯

import threading

number = abs(int(input("Number to check: ")))
thread_count = int(input("Thread count: "))


def find_odd_even(number_range):
    for i in number_range:
        exec(f"if number == {i}:\n    print('{'odd' if i % 2 else 'even'}')\n")


for thread_number in range(thread_count):
    number_range = range(thread_number, number + 1, thread_count)
    thread = threading.Thread(target=lambda: find_odd_even(number_range))
    thread.start()

#

It comes with multiple features.

  • Multithreading 🚀
  • Supports signed numbers 🤓
  • Dynamic scaling ⚖️
  • Made in Python 🐍
unique heath
#
  • Fast
  • Doesn't use % because % is slow
  • Made in Python
#
int main() {
    int n;
    cin >> n;

    if (n & 1) cout << "odd";
    else cout << "even";
}``` even faster program
- 🚀🚀faster than all 3 previous programs🚀🚀🚀🚀🚀
- 🚀🚀doesnt use the % 🚀🚀🚀🚀🚀🚀because the % is slow🚀🚀🚀
- 🚀🚀🚀🚀made in C++ for extra 🚀 speed🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🌑
- uses less memory
#

🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀

versed eagle
versed eagle
#

use unistd.h

unique heath
#

wut dat do

versed eagle
unique heath
#

at that point why not just scanf

versed eagle
#

read and write are C wrappers around syscalls

unique heath
#

huh

patent drift
#

truffles

unique heath
#

truffles

unique heath
versed eagle
#

theres no newline

#

so its incompatible with the python version

unique heath
#

who cares about compatibility

versed eagle
#

in that case just always output odd

#

who cares about compatibility, right :3

#

anyways, here

#include <unistd.h>
int main()
{
    char c, d;
    while (read(0, &c, 1))
    {
        if (c < '0' || '9' < c) break;
        d = c;
    }
    if (d & 1) write(1, "odd\n", 4);
    else write(1, "even\n", 5);
}
unique heath
#

huh

#

🚀🚀🚀🚀🚀blazingly fast🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀

versed eagle
#

becomes faster if you statically link it (&& use lto)

willow shadow
#

I made a chip8 decompiler fully in python.

young dirge
#

There isn't one as far as I know

unique heath
#

chips

fluid pumice
#

!e

a=lambda:__builtins__.__import__('sys').stdout.write((__builtins__.__dir__()[len(__builtins__.__dir__()[++18]+__builtins__.__dir__()[--0])][(0xf-0x1)-int(str('++-+'.replace(*'+1')).replace(*'-0'),len(__build_class__.__dir__()[--0].strip('__'))+0xa-int('1100',2))])+(__build_class__.__dir__()[len(__builtins__.__dir__()[0x86+0xe])+len(__builtins__.__dir__()[-1])])[0xa-0x7]+2*(__builtins__.__dir__()[int("11",len(__builtins__.__dir__()[0xc+0xf]))][0xa-0x8])+(__builtins__.__dir__()[0x86][1])+chr(32)+chr(119)+(__builtins__.__dir__()[0x86][1])+(__builtins__.__dir__()[0xa-0x7][0x7])+(__builtins__.__dir__()[int("11",len(__builtins__.__dir__()[0xc+0xf]))][0xa-0x8])+__builtins__.__dir__()[1][2]);a()
night quarryBOT
#

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

hello world
unique heath
#

too little _, --

#

:P

unique heath
#

real

dense mural
arctic skiff
#

"esoteric"

dense mural
#

Hmmm... True, But Does Obfuscation Count? I Mean Like Keys With Subtraction And Useless ++{number} 🤔

quartz wave
#

and obfuscation comes in many different forms

dense mural
#

I Need To Learn To Read Discord Channel Descriptions

long fulcrum
#

anyone got any better solutions to this:

[print(i)for i in range(51)if i.bit_count()&1]```
#

thats 46 chars and theres solutions down to 40 i been stuck on this one for 2 years

#

prints numbers from 0-50 that have an odd popcount/bitcount

#

!e

[print(i)for i in range(51)if i.bit_count()&1]```
night quarryBOT
long fulcrum
#

but this doesnt work

#

!e

for i in range(51):
    if i^(2*i+1):print(i)```
night quarryBOT
fleet lintel
night quarryBOT
#

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

001 | [1, 2, 7, 4, 13, 14, 11, 8, 25, 26, 31, 28, 21, 22, 19, 16, 49, 50, 55, 52, 61, 62, 59, 56, 41, 42, 47, 44, 37, 38, 35, 32, 97, 98, 103, 100, 109, 110, 107, 104, 121, 122, 127, 124, 117, 118, 115, 112, 81, 82, 87]
002 | True
fleet lintel
#

You can also see why that is the case based on this section of the oeis page

Lexicographically earliest sequence of distinct nonnegative integers with no term being the binary exclusive OR of any terms.

long fulcrum
#

the shortest i can get that is 60

[i<51==print(i)for i in sorted([i^2*i+1for i in range(50)])]```
sudden osprey
#

!e you can hard code the number of values you need once sorted, and use a set to sort it (if relying on implementation details is allowed...), though still longer than your original solution

[*map(print,[*{i^2*i+1for i in range(50)}][:26])]
night quarryBOT
#

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

001 | /home/main.py:1: SyntaxWarning: invalid decimal literal
002 |   [*map(print,[*{i^2*i+1for i in range(50)}][:26])]
003 | 1
004 | 2
005 | 4
006 | 7
007 | 8
008 | 11
009 | 13
010 | 14
011 | 16
... (truncated - too many lines)

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

long fulcrum
#

cool thing you can do to make your code shorter is this though

[*map(print,[*{i^2*i+1for i in range(50)}][:26])]
*map(print,[*{i^2*i+1for i in range(50)}][:26]),```
#

how does your code sort the list actually

sudden osprey
long fulcrum
#

so sorted(i) is the same as {*i}?

sudden osprey
#

For small, positive, integers in current CPython, I think so

restive void
#

It basically sorts them by their hash value (or the last n bits of it). Positive integers hash to themselves. That does mean that if there are gaps, the result isn't necessarily sorted, even for small positive integers.

#

!e

print({*(1, 8)})
night quarryBOT
#

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

{8, 1}
restive void
#

So you just have to be a bit lucky. Since this list is "full enough", it works out

sudden osprey
#

ah, nice

bright valve
#

I want to start to learn how python works from behind

#

where could I get some resources on it?

versed eagle
#

the best resource ^^

bright valve
#

ill take a look

#

thanks

unique heath
fleet bridge
unique heath
#
[print(i)for i in range(51)if len(bin(i))&1]
``` still shorter
fleet bridge
#

this is not the same

unique heath
#

why

fleet bridge
#

.bit_count != .bit_length

long fulcrum
#

the parity bit just needs to be inverted

unique heath
fleet lintel
night quarryBOT
#

int.bit_count()```
Return the number of ones in the binary representation of the absolute value of the integer. This is also known as the population count. Example:

```py
>>> n = 19
>>> bin(n)
'0b10011'
>>> n.bit_count()
3
>>> (-n).bit_count()
3
```  Equivalent to...
unique heath
#

huh

long fulcrum
#

I have an exam tomorrow

#

after that I have a feeling I'll need to get a pen and paper to solve it

#

I doubt I can tbh

unique heath
#

challenge: hash table, but you have to write your own hash function

#

golfed

quartz wave
versed eagle
unique heath
#
def h(x):
 if isinstance(x,str):return int.from_bytes(x.encode("u8"),"big"))
 elif isinstance(x,bytes):return int.from_bytes(x,"big")
 else:return x
t=type("",(,),{"__init__":self.a=[0]*200,"__getitem__":lambda x:self.a[h(x)%200],"__setitem__":lambda x,y:self.a.__setitem__(h(x)%200,y)})``` fucked solution
#

!e

def h(x):
 if isinstance(x,str):return int.from_bytes(x.encode("u8"),"big")
 elif isinstance(x,bytes):return int.from_bytes(x,"big")
 else:return x
t=type("",(,),{"__init__":self.a=[0]*200,"__getitem__":lambda x:self.a[h(x)%200],"__setitem__":lambda x,y:self.a.__setitem__(h(x)%200,y)})

a = t()
a[3] = 4
print(a[3])```
night quarryBOT
#

@unique heath :x: Your 3.12 eval job has completed with return code 1.

001 |   File "/home/main.py", line 5
002 |     t=type("",(,),{"__init__":self.a=[0]*200,"__getitem__":lambda x:self.a[h(x)%200],"__setitem__":lambda x,y:self.a.__setitem__(h(x)%200,y)})
003 |                ^
004 | SyntaxError: invalid syntax
quartz wave
#

mk we'll go from there i guess

unique heath
#

i-

#

what

unique heath
quartz wave
#

!e ```py
def h(x):
if isinstance(x,str):return int.from_bytes(x.encode("u8"),"big")
elif isinstance(x,bytes):return int.from_bytes(x,"big")
else:return x
t=type("",(),{"init":lambda x:setattr(x,'a',[0]*200),"getitem":lambda ,x:.a[h(x)%200],"setitem":lambda ,x,y:.a.setitem(h(x)%200,y)})

a = t()
a[3] = 4
print(a[3])

night quarryBOT
#

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

4
unique heath
#

waot what dod o get wrong

#

oh

#

(,)

#

;-;

quartz wave
#

..and the lambdas not including a self

unique heath
#

you saw nothing 👀

quartz wave
#

well other than that you're completely finee

unique heath
#

(that is not fine)

unique heath
fleet bridge
#

what do you think about using PingFS for swap space?
somebody should implement that

versed eagle
fleet bridge
#

we can use that for storing caches
each ping packet stores integer number of cache entries, and if it gets lost - not a big deal, we can treat it as cache miss, recalculate result and cache it

fleet lintel
#

Isn't the point of a cache to store data for fast + easy reading? From my understanding of storing data in pings, you can only read the data when you get the echo back, which means you'll always get a cache miss unless the result is fetched at the exact same time the echo returns, which could be on the order of hundreds of ms. And if you temporarily store the data locally, what's even the point of storing it in echos in the first place?

long fulcrum
#

for fun

swift viper
#

print("Hello")

fleet bridge
#

you tried

wheat river
wheat river
#

its not completely dunder tho

long fulcrum
#

any idea how to golf this further

r=range(2,37);*map(print,sorted({l for x in r for y in r if(l:=x**y+y**x)<1e11})),```
#

prints all leyland numbers (numbers of the form x^y + y^x where 1 < y ≤ x) from 1-100,000,000,000

#

mines 82 bytes shortest is 73

quartz wave
vast wave
#

also one expression

long fulcrum
#

oh wait i dont think that works if the range has a start

long fulcrum
#

lmao im such a fucking idiot that was so easy

long fulcrum
#

i got a 74

r=range(2,37);*map(print,sorted({x**y+y**x for x in r for y in r})[:107]),```
#

ive heard the 73 described as black magic

long fulcrum
#

does anyone know the 58b for fizz buzz from 1-100

#

ive got a 59

#
for i in range(100):print(i%3//2*'Fizz'+i%5//4*'Buzz'or-~i)```
fleet bridge
#

because or-~i is shorter than or i+1 or or 1+i

arctic skiff
#

oh

#

nvm got it

#

its 1-100 not 0-99

fleet bridge
#

i%3//2 this checks if i === -1 mod 3, not i === 0 mod 3

quartz wave
#

i feel like there should be a better way of doing those minus-even stuff

#

nvm

#

doesn't work

robust adder
#

Can someone explain in simple words what that rec dict is trying to do? what is the work of the first line in the rec dict?

#

@flint zodiacs

long fulcrum
#

well you can get rid of the not by switching round your two assignments

#

also remove white space and rename functions to be one char

#

you can also put the if else inline

#
while len(c.keys())<10810803:
  x=shuffle_sequence(x))if x in reduce(or_,[*c.values()])else c[x]=create_set(x)```
#

that should be it i think

#

also rename shuffle_sequence and create_set to something shorter

turbid dragon
#

!e
a=1 if True else a = 2

night quarryBOT
#

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

001 |   File "/home/main.py", line 1
002 |     a=1 if True else a = 2
003 |     ^^^
004 | SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
long fulcrum
#

ah yeah was worried about that

#

would a walrus work

turbid dragon
#

yes

#

I would think it would be
(x:=shuffle_sequence(x)if x in reduce(or_,[*c.values()])else c[x].__setitem__(create_set(x)))

long fulcrum
#

walrus not work on the else?

turbid dragon
#

no

#

!e
x = {}
(x["a"]:=1)

night quarryBOT
#

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

001 |   File "/home/main.py", line 2
002 |     (x["a"]:=1)
003 |      ^^^^^^
004 | SyntaxError: cannot use assignment expressions with subscript
long fulcrum
#

oh yeah i remember that issue

#

kept running into that trying to solve ascending primes

fleet bridge
#

wtf is reduce(or_, [...])
isnt it the same as any(...)?

restive void
fleet bridge
#

aahh

#

next(x for x in c if x)
reduce(or_, c)
any(c)

restive void
#

Ah no, or_ is |

fleet bridge
#

ohh

#

!d operator

night quarryBOT
#

Source code: Lib/operator.py

The operator module exports a set of efficient functions corresponding to the intrinsic operators of Python. For example, operator.add(x, y) is equivalent to the expression x+y. Many function names are those used for special methods, without the double underscores. For backward compatibility, many of these have a variant with the double underscores kept. The variants without the double underscores are preferred for clarity.

The functions fall into categories that perform object comparisons, logical operations, mathematical operations and sequence operations.

The object comparison functions are useful for all objects, and are named after the rich comparison operators they support:

fleet bridge
#

does operator have function for "logical" and/or?

restive void
#

No, I just checked

fleet bridge
#

!d operator.not_

night quarryBOT
#

operator.not_(obj)``````py

operator.__not__(obj)```
Return the outcome of [`not`](https://docs.python.org/3/reference/expressions.html#not) *obj*. (Note that there is no `__not__()` method for object instances; only the interpreter core defines this operation. The result is affected by the [`__bool__()`](https://docs.python.org/3/reference/datamodel.html#object.__bool__) and [`__len__()`](https://docs.python.org/3/reference/datamodel.html#object.__len__) methods.)
fleet bridge
#

weird description

#

why is there operator.__not__ at all

#

why not just operator.not_

restive void
#

I'd do set.union(*my_sets) then

fleet bridge
#

that wont work if my_sets is empty

#

i dont think reduce will work either

restive void
#

set().union(*my_sets) then

fleet lintel
restive void
earnest wing
#

or filter(None if you fancy

sick hound
#

!e

is_alife = False
if is_alife != True:
  print("Damn you ded")
else:
  print("You aint ded yet")
fluid pumice
devout iris
#

n=int(input())
s=0
l=[]
for i in range(0,n):
l.append(int(input()))
for i in l:
if i%2==0:
s+=i
print(s)

quartz wave
#
while len(c)<max_num:
 if{x}&reduce(or_,c.values()):x=shuffle_sequence(x)
 else:c[x]=create_set(x)
gleaming linden
#
if{x}&reduce(or_,c.values())
if any(x in c[k]for k in c)
```-1
quartz wave
unique heath
#

um so what we doing

quartz wave
unique heath
#

i see

marble imp
unique heath
quartz wave
crude raft
fleet bridge
#

can we?

gleaming linden
#

wasn't there also a thing with most unique chars (and repeated ones take away points)?

unique heath
#

me adding every unicode ccharacter ever

finite blaze
#

the if part

gleaming linden
finite blaze
#

if{x}&reduce(or_,c.values())

#

this

gleaming linden
#

oh I didn't write that

#

but or_(a, b) = a | b

finite blaze
#

_ what is it doing there?

gleaming linden
#

it's part of the function name

#

to avoid clashing with the keyword

finite blaze
#

ah i see

gleaming linden
#

and reduce(f, a) = f(f(f(a[0], a[1]), a[2]), a[3])...

#

since the values are sets, it's basically doing set.union(*c.values())

errant rover
#

Pythin

fleet bridge
#

because all compound operators must start at the beginning of the line

vast wave
#

this is possible in other langs but syntactically it wont work in python

earnest wing
#

https://gist.github.com/RocketRace/f501ddda25f65a817f7878f09ce84f0f
I made this completely useless 300-line-long regex that matches extended grapheme clusters from a byte stream
example usage:

>>> pattern = ... # gist
>>> import re
>>> string = b'\xe3\x81\x93\xe3\x82\x93\xe3\x81\xab\xe3\x81\xa1\xe3\x81\xaf, \xf0\x9f\x8c\x8e! a\xcc\x80\xcc\x80\xcc\x81\xcc\x84\xcc\x8a\xcc\x89\xcc\x8db\xcc\x9b\xcc\x92\xcc\x8d\xcc\xadc\xcc\x98\xcc\x90d\xcc\x9b'
# こんにちは, 🌎! à̀́bcd̄
>>> len(string)
55 # number of bytes
>>> len(string.decode("utf-8")
28 # number of codepoints
>>> len(re.findall(pattern, string))
14 # number of extended grapheme clusters
long fulcrum
#

could you inline it with .__setitem__?

quartz wave
fleet lintel
#

I love the non-capturing group soup to isolate ors

earnest wing
#

my initial generated regex was, um. 82,000 lines long

#

until i started using ranges

#

yours is also magnificent

fleet lintel
#

amazing. Mine could be shorter, but I decided to have both lookaheads and behinds be fixed-width (as opposed to lookbehinds fixed, while lookaheads variable, which feels ick)

marble imp
#

this is not esoteric but it looks

fleet lintel
#

hooray for box drawing characters

long fulcrum
#
j=j[e==']':]+' '[e!='[':]```
#

anyone able to golf this further?

#

j starts off as an empty string

restive void
#

What is it supposed to do? Seems like it just turns j into a single space if e is "[", and doesn't do anything otherwise.

long fulcrum
#

it manages indentation for a bf interpreter, it adds another space if e is [, removes one if it's ] and remains the same otherwise

long fulcrum
#

I found that on stack overflow it's really cool I don't think I've seen anything like it before

glossy rampart
#
main=lambda v:print(f"36 + {v} = {36+v}{'...nice.'*(v==33)}")```
can this thing be golfed even further?
expected results: ```
>>> main(33) 
36 + 33 = 69...nice.

>>> main(31) 
36 + 31 = 67```
restive void
#
main=lambda v:
def main(v):
long fulcrum
#

-1

print(f"36 + {v} = {36+v}"+'...nice.'*(v==33))```
quartz wave
long fulcrum
#

that errors

#

wait nvm I fucked up my copy paste

#

I didn't know you could do that

fleet bridge
#

i also had this idea, but i rejected it because of this

#

and sadly f'{36 + {v} = }' is not a thing

long fulcrum
#

more concise way to write this?

if k = 5:i+=1
if k = -1:i-=1```
#

the 5 can be changed to any number from 0-5

#

if k isnt one of the two selected values though i cant change

long fulcrum
#

thank you 🙏

long fulcrum
#

changed it to this c+=(j>4)-(j<0)

#

wonder can i do an inequality type thing

quartz wave
#

assuming it only goes in range(-1, 6)

long fulcrum
#

yep it does thanks

glossy rampart
#

thank you @restive void @long fulcrum

sick hound
#

will there only be one module in python file or is there a chance for multiple modules?

versed eagle
fleet bridge
#

why does the smiley face prints variables

#

i swear i dont have any emoji-related things in repl

#

no idea

#

i don't even know how this could happen by accident
globals() and vars() return different dicts, dir() returns list with correct keys

rugged sparrow
fleet bridge
#

yes, pyreadline3

#

but with my stuff on top

versed eagle
fleet bridge
#

i figured it out!

versed eagle
#

do tell

fleet bridge
#

1

i have an excepthook that handles SyntaxErrors with ? symbol in the source code
this allows me to do foo? in the repl: it will raise SyntaxError, my excepthook will capture that and will run help(foo). This is a lot more convenient than doing help(foo) all the time

when i was writing this, i thought: what if i enter only ? symbol without anything else? i dont want to run help(), i should do something else instead
and i decided to print filtered value of __main__.__dict__
code looks like this: ```py

def syntax_excepthook(typ: type[SyntaxError], val: SyntaxError, tb: types.TracebackType | None):
    if val.text is None or '?' not in val.text:
        return base_hook(typ, val, tb)
    if val.filename != '<stdin>':
        return base_hook(typ, val, tb)

    text = val.text.replace('?', '').strip()
    import __main__

    if not text:
        # display locals
        x = __main__.__dict__
        x = {k: v for k, v in x.items() if not k.startswith('__')}
        sys.displayhook(x)
        return

    try:
        obj = eval(text, __main__.__dict__)
    except Exception as exc:
        exc = exc.with_traceback(None)
        return base_hook(exc.__class__, exc, None)

    help(obj)
and then i completely forgot about this feature because i can get locals in a standard way: `locals()` / `globals()`

# 2
when i paste emojis to my terminal, they for some reason are converted to `??` under the hood
you can see this in reprs of such strings on my screenshots - they are indeed ascii `??`, not something unicode-ish

so, i am entering `??` into repl, it raises `SyntaxError`, excepthook strips all `?` and finds empty string - it means it should print `__main__.__dict__`!
long fulcrum
versed eagle
# long fulcrum wdym?

it was a sed reference
i was asking if if k = 5:i+=1 was supposed to be if k == 5:i+=1 (because the former isn't valid python syntax)

long fulcrum
#

oh shit yeah didnt even notice 😭

long fulcrum
#

anyone have any idea how to do this with a start step

fleet bridge
#
for i in range(0, s1*n, s1):
  for j in range(0, s2*m, s2):
    do(i, j)

for k in range(n*m):
  do(k//m*s1,k%m*s2)
fleet bridge
#
for i in range(a, a+s1*n, s1):
  for j in range(b, b+s2*m, s2):
    do(i, j)

for k in range(n*m):
  do(a+k//m*s1,b+k%m*s2)
``` didnt test, but i think this should work
long fulcrum
#

let me try that out

fleet bridge
#

stuff you can do heavily depends on particular properties of (start,stop,step) values
i dont think you can do much in general, but in special cases you can do cool tricks

#
for i in range(a1, b1, c1):
    for j in range(a2, b2, c2):
        do(i, j)

print('#')

n1 = (b1-a1)//c1
n2 = (b2-a2)//c2
for k in range(n1*n2):
    do(a1 + k // n2 * c1, a2 + k % n2 * c2)
``` this is the general case
if you shorten names and remove whitespace, it looks like this: ```py
# 56 chars
for x in range(x,x,x):
 for x in range(x,x,x):
  do(x,x)

# 64 chars
x=(x-x)//x
x=(x-x)//x
for x in range(x*x):
 do(x+x//x*x,x+x%x*x)
long fulcrum
fleet bridge
#

you are misunderstanding

fleet bridge
long fulcrum
#

if steps just 1 though can it not just be removed

fleet bridge
#
do=print
a,b,c,d=2,4,2,4

# 52
for i in range(a,b):
 for j in range(c,d):
  do(i,j)

print('#')

# 48
m=d-c
for k in range((b-a)*m):
 do(a+k//m,c+k%m)

long fulcrum
#

its longer 😢

#

how the fuck is the leyland numbers 73 possible

#

i gotta know

fleet bridge
#

i have 78

fleet bridge
#
r=range(2,37);*map(print,sorted({x**y+y**x for x in r for y in r})[:107]), # 74, with help from @firegene
r=range(2,37);print(*sorted({x**y+y**x for x in r for y in r})[:107],sep='\n')
r=range(2,37);print(*sorted(x**y+y**x for x in r for y in r if x>=y)[:107],sep='\n')
print(*sorted({(a:=2+k//35)**(b:=2+k%35)+b**a for k in range(1225)})[:107],sep='\n')
print(*sorted({(a:=k//35)**(b:=2+k%35)+b**a for k in range(70,1295)})[:107],sep='\n')
print(*sorted({(k//35)**(b:=2+k%35)+b**(k//35)for k in range(70,1295)})[:107],sep='\n')
print(*sorted({(2+k//35)**(2+k%35)+(2+k%35)**(2+k//35)for k in range(1225)})[:107],sep='\n')
#
(x)**(y)
pow(x,y)

(k//n)**(k%n)
pow(k//n,k%n)
pow(*divmod(k,n))
long fulcrum
#

your first ones the 74

#

you just gotta print it like py *map(print,sorted(...)),

fleet bridge
#

nice

long fulcrum
#

yeah any time I go to golf something I always check that site first

long fulcrum
#

is there any way to not have to assign j

"string"[j:='><+-.['.find(i)];c+=j//5```
fleet bridge
#

you can save the char and do c=='['

#

t:='string'[...];c+=t=='['

#
"string"[j:='><+-.['.find(i)];c+=j//5
t:="string"['><+-.['.find(i)];c+=t=='['
``` not really helpful
long fulcrum
#

that doesnt work

#

i use the -1 that find returns if it cant find it

long fulcrum
#

looks like I'll be stuck on 183 for brainfuck for a while then

#

atp I feel the optimal solution is completely different from mine

#

it's 167

#

I feel like I need a rewrite

sick reef
#

!e

print(chr((32 << 1) + 40)+chr((((((1 << 4) + 4) << 2) + 3) & 127) + ((1 << 3) + 10))+chr((((((1 << 4) + 5) << 2) + 5) & 127) + ((1 << 3) + 11))+chr((((((1 << 4) + 2) << 2) + 2) & 120) + ((2 << 3) + 20))+chr((47 << 1) + (64 >> 5) + 15))```
night quarryBOT
#

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

hello
sick reef
#

Anyone want to give me the run down on how bitshifts are made?
I understand the concept just not how people make them.

fleet bridge
#

<<n === *2**n

sick hound
#

!e

num1 = 10
print(num1 ** 3)
night quarryBOT
#

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

1000
unique heath
#

A barrel shifter is a digital circuit that can shift a data word by a specified number of bits without the use of any sequential logic, only pure combinational logic, i.e. it inherently provides a binary operation. It can however in theory also be used to implement unary operations, such as logical shift left, in cases where limited by a fixed a...

unique heath
#

how exactly are we supposed to program in it

sick hound
#

interpret([0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2])

unique heath
#

and... what exactly d othose opcodes do

sick hound
# unique heath and... what exactly d othose opcodes do
def do_next_instruction(instruction, stack, ptr):
    # all instructions must be 4 bytes, even instructions which don't require parameters
    # instruction_byte [0 - 15], parameter [0 - 256], halftime_entropy_byte_1 [0 - 256], halftime_entropy_byte_2 [0 - 256]

    if len(instruction) != 4:
        return
    if instruction[0] > 15 or instruction[1] > 255 or instruction[2] > 255 or instruction[3] > 255:
        return
    
    p = -1

    match instruction[0]:
        case 0:
            stack[ptr] -= 6
        case 1:
            if ptr > stack[ptr]:
                stack[ptr] = (ptr % 217)
                ptr += 7
            else:
                ptr -= 7
                if ptr < 0:
                    ptr = 6
        case 2:
            stack[ptr] += int(instruction[1] * 0.7)
        case 3:
            stack[ptr] -= int(instruction[1] * 0.7)
        case 4:
            c = stack[0]
            d = stack[1]
            e = stack[2]
            if c < d * e and ptr < 128:
                stack[ptr] = 0
            elif d < c * e and ptr > 128:
                stack[ptr] = 1
            else:
                stack[ptr] ^= e
        case 5:
            stack[ptr] += stack[0]
        case 6:
            stack[ptr] += instruction[0]
        case 7:
            stack[ptr] += instruction[1] * instruction[0] - 6
        case 8:
            stack[int(ptr * 0.56) % 200] ^= (instruction[0] + instruction[1] + 2) % 27
        case 9:
            ptr = 8
            for i in range(0, 32):
                stack[i] = (stack[i + 1] ^ stack[i * 2])
        case 10:
            stack[ptr] = stack[instruction[1]]
        case 11:
            p = stack[ptr]
        case 12:
            ptr -= 1
        case 13:
            ptr = (ptr ^ instruction[1]) % 240
        case 14:
            ptr += 1
        case 15:
            ptr += 1 if ptr % 2 == 0 else -1
    if ptr > 255 or ptr < 0:
        ptr = 32
    elif stack[ptr] > 255 or stack[ptr] < 0:
        stack[ptr] = 0

    return [stack, ptr, p]
unique heath
#

🥴

sick hound
#

mostly just random operations, however basic arithmatic is supported too

#

also after every instruction is performed, a completely random one is also generated and performed so you kinda just gotta keep changing the entropy bytes until you find an instruction which helps you out or kinda does nothing

unique heath
#

i dont think this is turing complete

sick hound
unique heath
#
  • it literally wouldnt be possible to hello world
sick hound
#

its possible to do hello world

unique heath
#

you cant output anything

sick hound
#

case 11

#

p is the byte to print

#

it gets returned and appended to a print array

unique heath
#

it would only be able to utput numbers

sick hound
#

if you can get the print_array to become [72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33] then you've basically printed hello world

unique heath
#

chr isnt an opcode?

sick hound
#

you can print the array right at the end if you want to, but the reason i've done it this way as to not print everything is that it would just fill the terminal with random shit when the testing function is performed

#

print("".join(map(chr, interpret(instructions)[2])))

#

but anyway, i modified the interpret function to have a should_print parameter which when true will print the bytes at the end of execution

sick hound
#

discovered something unintended inside the code which makes printing any string pretty easy to do, i'd be surprised if anybody else finds it out though. managed to get a print("Hello World!")

||[2, 103, 0, 10, 2, 42, 0, 12, 2, 11, 0, 6, 2, 0, 0, 55, 2, 5, 0, 20, 3, 113, 0, 11, 2, 79, 0, 26, 2, 35, 0, 9, 2, 5, 0, 20, 3, 9, 0, 11, 3, 12, 0, 3, 3, 97, 0, 2] prints "Hello World!"||

restive void
#

You can just keep stack[0] as 0, and then choose your instructions such that one of the two (random or not) is 5 mod 16, then the whole randomness doesn't matter

#

You have incrementing, decrementing (by 6, but who cares), jumps, and two kinds of conditionals.. are you sure it's not Turing complete?

sick hound
lunar juniper
#

!eval ```py
print(bytes([2, 103, 0, 10, 2, 42, 0, 12, 2, 11, 0, 6, 2, 0, 0, 55, 2, 5, 0, 20, 3, 113, 0, 11, 2, 79, 0, 26, 2, 35, 0, 9, 2, 5, 0, 20, 3, 9, 0, 11, 3, 12, 0, 3, 3, 97, 0, 2]))

night quarryBOT
#

@lunar juniper :white_check_mark: Your 3.12 eval job has completed with return code 0.

b'\x02g\x00\n\x02*\x00\x0c\x02\x0b\x00\x06\x02\x00\x007\x02\x05\x00\x14\x03q\x00\x0b\x02O\x00\x1a\x02#\x00\t\x02\x05\x00\x14\x03\t\x00\x0b\x03\x0c\x00\x03\x03a\x00\x02'
lunar juniper
#

!eval ```py
print(bytes([2, 103, 0, 10, 2, 42, 0, 12, 2, 11, 0, 6, 2, 0, 0, 55, 2, 5, 0, 20, 3, 113, 0, 11, 2, 79, 0, 26, 2, 35, 0, 9, 2, 5, 0, 20, 3, 9, 0, 11, 3, 12, 0, 3, 3, 97, 0, 2]).decode())

night quarryBOT
#

@lunar juniper :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | g�
002 | *�
003 | 
004 | ���7�q�
005 | O�#�	�	�
006 | 
007 | �a�
lunar juniper
#

well...

#

001 | g
002 | *
003 | 
004 | 7q
005 | O# 
006 | 
007 | a

#

weird output

fleet bridge
#

what did you expect?

lunar juniper
#

print "hello world"

frank granite
#

Hello, I am facing module 'bcrypt' has no attribute 'about' when usin CryptContext from passlib

#

Does anyone have a clue ?

fleet lintel
frank granite
frank granite
versed eagle
frank granite
pliant tulip
#

I'm trying to create an exif tool that will do something that i want it to do.
I want to figure out why every image i check have these tags ( i checked 6-7 images).
I want to create a tool to generate fake-metadata for images and i want to figure out a few configurations of camera models that generate EXIF meta.

so basically i want some data that i want to stick to images i give, (fake data to real images)

can anyone help me 🙂

#

this is a weird topic

#

there should be a 'cameras' channel

grave grail
#

you probably need to check the image formatting system (how do they store metadata) and change it

fleet bridge
#

!e ```py
ᅠ = 0
ᅠᅠ = ᅠ + ᅠ
print(ᅠ + ᅠᅠ)

class ᅠᅠᅠ():
ᅠᅠ: int
def ᅠ(ᅠ, ᅠᅠ):
return ᅠ.ᅠᅠ + ᅠᅠ

ᅠᅠᅠᅠ = ᅠᅠᅠ()
ᅠᅠᅠᅠ.ᅠᅠ = 42
print(ᅠᅠᅠᅠ.ᅠ(ᅠᅠ))

night quarryBOT
#

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

001 | 0
002 | 42
pine wolf
#

!e

def xor(flip, ret, cont):
    def cont1(x):
        def cont2(y):
            return ret((x and (not y)) or ((not x) and y), cont)
        return flip(cont2)
    return flip(cont1)


def main():
    xor_values = xor(
            lambda cont: cont(True) + cont(False),
            lambda x, cont: cont([x]),
            lambda x: x
            )
    print(xor_values)

if __name__ == '__main__':
    main()
night quarryBOT
#

@pine wolf :white_check_mark: Your 3.12 eval job has completed with return code 0.

[False, True, True, False]
fleet bridge
#

!e ```py
for x, xᅠforᅠx in enumerate(range(10)):
print(x, xᅠforᅠx)
print([xᅠforᅠx in range(10)])

night quarryBOT
#

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

001 | 0 0
002 | 1 1
003 | 2 2
004 | 3 3
005 | 4 4
006 | 5 5
007 | 6 6
008 | 7 7
009 | 8 8
010 | 9 9
011 | [True]
... (truncated - too many lines)

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

digital mesa
#

lmao

gritty mesa
#

!charinfo

night quarryBOT
#
Missing required argument

characters

#
Command Help

!charinfo <characters>
Shows you information on up to 50 unicode characters.

gritty mesa
#

thank you discord

#

!charinfo n e

night quarryBOT
gritty mesa
#

!charinfo r x, xᅠforᅠx

night quarryBOT
gritty mesa
#

An imposter is among us

fleet bridge
#

!charinfo ᅠᅠ

night quarryBOT
fleet bridge
#

<
<

for some reason when pyright does autocomplete, it suggests the wide one -_-

near gust
#

!charinfo Ɛඞ

night quarryBOT
vestal crow
pine wolf
fleet lintel
#

I'll have to remember that tuples are an option for when you don't care about the return value. Since I usually do stuff inside lambdas that need to return, I default to and/or ```py
print(import("requests").get("https://httpbin.org/get").text)

For this at least, if you only need `requests`/`resp` once you can get rid of them and just chain the calls.
vestal crow
#

There’s multiple dunder methods like these that are unrelated to the classic OOP related dunder methods

#

Not sure why they exist and what they do

fleet lintel
# vestal crow Could anyone explain why a dunder import exists like this?/why is it a dunder

Just like how in classes dunder methods do magic, the same applies at the module level. The data model page has a full list. https://docs.python.org/3/reference/datamodel.html#modules . __import__ is how you can change the behavior of the import statement. One example I remember is this #1159960081186697296 message that uses it to get the actual python implementation of functools instead of the c implementation. There is also file-level dunders like __init__.py.
tldr python uses dunders for basically anything that invokes internal magic, not just class related things.

gleaming linden
#

I guess there's __all__ and __doc__ at the module level, but they aren't functions

fleet lintel
#

I just assume they meant all dunder attributes, since not everything is a method even at class level, like __code__

fleet bridge
#

!e print(__build_class__)

night quarryBOT
#

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

<built-in function __build_class__>
fleet bridge
#

it implements class statement

fleet lintel
#

I wonder if there's an equivalent for type as a soft keyword

fleet bridge
fleet lintel
#

Or I guess that might also resolve to class? The 3.12 type x = int

fleet bridge
fleet lintel
fleet bridge
#

all of it are implementation details

#

well, not all
but i wouldnt be surprised if some python implementations dont have most of this stuff

fleet lintel
#

oh yeah __debug__ exists too

fleet bridge
#

it is a keyword

#

kinda

#

!e ```py
debug # ok
debug = x # err

import builtins
builtins.debug # ok
builtins.debug = x # err
builtins.dict['debug'] # ok
builtins.dict['debug'] = x # ok

night quarryBOT
#

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

001 |   File "/home/main.py", line 2
002 |     __debug__ = x # err
003 |     ^^^^^^^^^
004 | SyntaxError: cannot assign to __debug__
fleet bridge
#

for some reason it exists in builtins, but is never used, because compiler replaces it with True/False

fleet lintel
#

That reminds me of this thing that exists #python-discussion message

$ cat o.py
def f():
  'f'
  x = bool(f.__doc__)
  assert (x := x + 1)
  print('-' + 'O'*(2-x))

f()
$ python o.py
-
$ python -O o.py
-O
$ python -OO o.py
-OO
fleet bridge
#

bruh

#

im interested, how often do you use -O/-OO? i never use it because it doesnt make a difference for me

fleet lintel
#

Never, I run all my things through pycharm anyways so I'd have to make a run configuration to do it.

fleet bridge
fleet bridge
fleet lintel
#

I like my current workflow since it helps keep the languages seperated in my mind. python is press the button, c# is ctrl+b/ctrl+r ingame, rust is terminal.

fleet bridge
#

-5 chars ```py
'-'
b='O'
assert not(b:='')
def f():
print(doc or'-O'+b)
f()

#

discord being discord

fleet lintel
#

hooray for fun edge cases, like you have 1or"" but not 0or""

gleaming linden
#

Oh wait that's the same length

#

How about assert(...)or 1

#

Nope

crude raft
gleaming linden
#

How about```py
'-'
b=0
assert(b:=1)
def f():
print(doc or'-OO'[:-b])
f()

#

!e ```py
assert(b:=0),

night quarryBOT
#

@gleaming linden :x: Your 3.12 eval job has completed with return code 1.

001 |   File "/home/main.py", line 1
002 |     assert(b:=0),
003 |                  ^
004 | SyntaxError: invalid syntax
gleaming linden
#

!e ```py
assert[b:=0]

night quarryBOT
#

@gleaming linden :warning: Your 3.12 eval job has completed with return code 0.

[No output]
gleaming linden
#

Ah

#

How about```py
'-'
b=1
assert[b:=0]
def f():
print(doc or'-OO'[:b])
f()

earnest wing
#

why is the function needed

quartz wave
#

58 ```py
'-O'
t=doc
assert(t:='-')
def f():print(t or'-OO')
f()

bright valve
#

what does that even do

quartz wave
#

w/o the function it's 46 ```py
'-O'
t=doc
assert(t:='-')
print(t or'-OO')

quartz wave
#

bonus: print X when -x is given as a command line option, no matter the optimization level

arctic skiff
#

from that code

vague junco
#

Is anyone here willing to deobfuscate code ?

#

Hit me up if so.I believe this one is kinda hard.

low lynx
vague junco
#

I can't know since it's obfuscated.

low lynx
#

where did you get it?

vague junco
vague junco
#

It's a source that i need to work on a project i have. It just creates proxies on your own pc. Can you help me ?

low lynx
#

I'm not running an obfuscated script on my pc, but idm attempting to deobfuscate it

vague junco
low lynx
#

just send it here

vague junco
#

ok

#

this is i t

#

@low lynx let me know if any progress if you dont mind.

restive void
vague junco
#

However it runs as python if you inspect start.bat

subtle solar
#

!rule 5

night quarryBOT
#

5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.

restive void
vague junco
#

The limited sniper is already done. (not by me)

restive void
#
$ python main.py
SyntaxError: Non-UTF-8 code starting with '\xa7' in file /path/to/main.py on line 1, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details
subtle solar
vague junco
#

I understand.

grave juniper
#

@limpid osprey can we have the discussion here?

limpid osprey
#

It's not really esoteric though

#

this is more for code golf and such

grave juniper
#

Okay, then where shall we have it?

limpid osprey
#

a help channel is the right place for this

finite blaze
#

!e

x = 'X'

if x == 'A' or 'B' or 'C': print("True")
else: print("False")
night quarryBOT
#

@finite blaze :white_check_mark: Your 3.12 eval job has completed with return code 0.

True
proper vault
#

!or-gotcha

night quarryBOT
#
The or-gotcha

When checking if something is equal to one thing or another, you might think that this is possible:

# Incorrect...
if favorite_fruit == 'grapefruit' or 'lemon':
    print("That's a weird favorite fruit to have.")

While this makes sense in English, it may not behave the way you would expect. In Python, you should have complete instructions on both sides of the logical operator.

So, if you want to check if something is equal to one thing or another, there are two common ways:

# Like this...
if favorite_fruit == 'grapefruit' or favorite_fruit == 'lemon':
    print("That's a weird favorite fruit to have.")

# ...or like this.
if favorite_fruit in ('grapefruit', 'lemon'):
    print("That's a weird favorite fruit to have.")
fleet bridge
#

!e ```py
import dis
dis.dis("x == 'A' or 'B' or 'C'")

night quarryBOT
#

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

001 |   0           0 RESUME                   0
002 | 
003 |   1           2 LOAD_NAME                0 (x)
004 |               4 LOAD_CONST               0 ('A')
005 |               6 COMPARE_OP              40 (==)
006 |              10 COPY                     1
007 |              12 POP_JUMP_IF_TRUE         3 (to 20)
008 |              14 POP_TOP
009 |              16 LOAD_CONST               1 ('B')
010 |              18 RETURN_VALUE
011 |         >>   20 RETURN_VALUE
... (truncated - too many lines)

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

torn agate
#

So whats the shortest way to create an iterable of size n where n is in the form of a string

"x"*int(n)

Is the shortest ive found so far, but im wondering if theres a fancy fstring or % logic available for this

#

my solution is a whole 10 characters

restive void
#
f"{0:<{x}}"

is eleven characters

torn agate
#

not so useful then is it jam_mechasaurus

restive void
#

Ah, you can drop the <, but that's the same then

torn agate
#

hmm, maybe theres a % alternative for this?

#

to avoid the f and {}

#

I have no clue how python2 formatting works though

#

i was also thinking of tuple/list/set multiplication

restive void
#

f"%{x}d"%0 is again 10 chars. You need the f-string because of the nesting (we want x in the format specifier itself)

#

I think this is probably the limit.

torn agate
#

grr

#

wait

#

Nvm, I was thinking "we know what n is", but no, its to be dynamic

#

Hmm, if n is known to be a single character then actually

n*int(n)
#

But I'm actually using n as a substitute for input() so that wouldn't really work

frigid lily
#
[          (a_p, s_p, d_p) 
        for d_p in d_hs 
      for i2, d_hs in enumerate(A) 
    for j2, s_p in enumerate(a_hs) 
  for j, a_p in enumerate(a_hs) 
for i, a_hs in enumerate(A) 
          if i != i2 and j != j2
]```
We'll do a little batch loading [with true formating]
low lynx
#

why is a_hs both a loop variable and an iterable

quartz wave
low lynx
quartz wave
#

eh i don't know what to expect given the unique indentation style

low lynx
#

also itertools.combinations moment

bright valve
dense mural
indigo remnant
#

@dense mural can u help me

dense mural
velvet sage
#

Using DFS for maze gen goes crazy

floral meteor
#

ah yes, minimum line length. What could possibly go wrong?

arctic skiff
gleaming linden
#

pep 9001

#

&pep 9001

solid lichenBOT
#
**PEP 9001 - The Final Style Guide for Python Code**
Status

Provisional

Created

01-Apr-2022

Type

Standards Track

gleaming linden
#

Created for 2022 april fools

arctic skiff
#

ok

sick hound
serene vessel
radiant anchor
#

!e

exec( bytes( x &   # ex-ec bytes x and
255                # two hun-dred and fif-ty five
for x in map( ord  # for x in map ord
,"󠁛󠁰󠁲󠁩󠁮󠁴󠀨󠀢󠁦󠁩󠁺󠁺󠀢󠀪󠀨󠀱󠀭󠁩󠀥󠀳󠀩󠀫󠀢󠁢󠁵󠁺󠁺󠀢󠀪󠀨󠀱󠀭󠁩󠀥󠀵󠀩󠁯󠁲󠀠󠁩󠀩󠁦󠁯󠁲󠀠󠁩󠀠󠁩󠁮󠀠󠁲󠁡󠁮󠁧󠁥󠀨󠀱󠀬󠀱󠀰󠀱󠀩󠁝")))             # ~
night quarryBOT
#

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

001 | 1
002 | 2
003 | fizz
004 | 4
005 | buzz
006 | fizz
007 | 7
008 | 8
009 | fizz
010 | buzz
011 | 11
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/44AUKTVDZCKM7ZZU3IG7LYF3BY

quartz wave
# radiant anchor !e ```py exec( bytes( x & # ex-ec bytes x and 255 # two hun-dre...

wh- ```pycon

t=b.decode()
from unicodedata import name
name(t[0])
'TAG LEFT SQUARE BRACKET'
name(t[1])
'TAG LATIN SMALL LETTER P'
name(t[2])
'TAG LATIN SMALL LETTER R'
name(t[2])
'TAG LATIN SMALL LETTER R'
name(t[4])
'TAG LATIN SMALL LETTER N'
name(t[5])
'TAG LATIN SMALL LETTER T'
name(t[6])
'TAG LEFT PARENTHESIS'
name(t[7])
'TAG QUOTATION MARK'
name(t[8])
'TAG LATIN SMALL LETTER F'
name(t[9])
'TAG LATIN SMALL LETTER I'

radiant anchor
#

😎

quartz wave
radiant anchor
#

yeah that was my attempt at idiomatic-yet-concise fizzbuzz

#

(with emphasis on the concise, lol)

quartz wave
radiant anchor
#

I mean, you could just run the script sans exec

#

or replace exec with print, rather

quartz wave
#

yyyeah..

#

didn't think of that

radiant anchor
#

!e exec(bytes(ord(x)&255 for x in"󠁛󠁰󠁲󠁩󠁮󠁴󠀨󠀢󠁦󠁩󠁺󠁺󠀢󠀪󠀨󠀱󠀭󠁩󠀥󠀳󠀩󠀫󠀢󠁢󠁵󠁺󠁺󠀢󠀪󠀨󠀱󠀭󠁩󠀥󠀵󠀩󠁯󠁲󠀠󠁩󠀩󠁦󠁯󠁲󠀠󠁩󠀠󠁩󠁮󠀠󠁲󠁡󠁮󠁧󠁥󠀨󠀱󠀬󠀱󠀰󠀱󠀩󠁝"))

night quarryBOT
#

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

001 | 1
002 | 2
003 | fizz
004 | 4
005 | buzz
006 | fizz
007 | 7
008 | 8
009 | fizz
010 | buzz
011 | 11
... (truncated - too many lines)

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

radiant anchor
#
exec(bytes(ord(x)&255 for x in '󠁛print("fizz󠀢󠀪󠀨󠀱󠀭󠁩󠀥󠀳󠀩󠀫󠀢buzz"󠀪󠀨󠀱󠀭󠁩󠀥󠀵)󠁯󠁲󠀠󠁩󠀩󠁦󠁯󠁲󠀠󠁩󠀠󠁩󠁮󠀠󠁲󠁡󠁮󠁧󠁥󠀨󠀱󠀬󠀱󠀰󠀱󠀩󠁝'))

another variation (does the same thing, but more misleading)

shy quail
proper vault
#

yeah, python does modulo, C et al do remainder

#

modulo is usually more useful

edgy ivy
#

Wrote a brainfuck interpreter in python

arctic skiff
edgy ivy
#

I would have no idea where to begin

shy quail
#
a, *b = 1, 2, 3
print(f"a: {a}, b: {b}")
# a: 1, b: [2, 3]

def foo(a, *b):
    print(f"a: {a}, b: {b}")

foo(1, 2, 3)
# a: 1, b: (2, 3)

Why does the former become a list and the latter become a tuple?

proper vault
#

the basic idea is that lots of algorithm like to use unpacking, then modify the list, while you shouldn't be modifying arguments

shy quail
#
a = 1, 2
b = *a, # last comma is needed!
print(b)
pure cliff
#

Hey All,
I want to know the names of some of the RPA tools which are not cloud native?

shy quail
#

Repost:
Can we evaluate 5! (five factorial) with list comprehension?

input = range(1, 6)
output = [....]
print(output)

Any difficulty, complexity, verbosity, etc are always welcome because it is only for learning purposes.

proper vault
night quarryBOT
#

@proper vault :white_check_mark: Your 3.12 eval job has completed with return code 0.

120
shy quail
#

It is a funny button. If I click it, the bot says "This is not your button to click!".
So why did the bot provide me with this button? 🙂

#

The button no longer exists now.

proper vault
#

likely the option to show a button to a single person didn't exist or doesn't exist

#

or we just didn't know about it

turbid dragon
#

Theres a couple too many for loops in here for my liking; does anyone have any ideas on how to reduce the tokens?

(PA:=str.__call__().join([chr(x)for(x)in[((None,sum((range.__call__(int.__call__((3-1j).real-1),7))),True)[1]-1)*10**1//2]*2])),(_x_B:=lambda A____,_B:(z:=(complex.__call__(*[9,2])-3j)).real%4),(AP:=PA),(AAAAA:=lambda __,_:(~int(_x_B(__,_)))),(GGENN:=lambda *a:-1),(ZZZ_ :=type("_yy", (), {"__sub__":AAAAA,"__mod__":lambda *a:-1,rf"{PA}add{AP}":_x_B,"__mul__": _x_B,"f":lambda m:[a is Ellipsis or a>=1 for a in m],"__UU9":list(),"__truediv__":lambda *A:1j,"__gt__":lambda *_:0,"imag":None,"__matmul__":lambda xX,Xx:3+3-3,fr"{PA}rox{PA}"[::-1]:lambda Zz,zZ:int(False)>True,"__ge__":GGENN})),(CC_:="ETIANMSURWDKGOHVF L PJBXCYZQ"),(YZ_A:=[[]])
def p(*x:__import__("typing").Any,_:__import__((CC:="fishhook")).hook.cls(type(...))(ZZZ_)={}):
  for(eEE_,_ALz )in(ne:=enumerate)(x):
    if(_ALz.imag)or _ALz>2:ZZZ_.__UU9=[*ZZZ_.__UU9,ZZZ_.f(list(x[(tt:=len(sum(ZZZ_.__UU9,start=[])))+len(list(filter(bool,ZZZ_.__UU9))) if(ZZZ_.__UU9)else 0:eEE_])),*list(filter(lambda m:isinstance(m,list),[None if not(not _ALz.imag and _ALz>2)else[]]))]
  for(LLZZ_)in ZZZ_.__UU9:
    if(YZ_A.append([])or(p:=0)or LLZZ_ ==[]):continue
    for(M_SA)in([*LLZZ_,*([True]if(z:=YZ_A.pop())else[])] ):p=2*p+(int(M_SA)-1)*-1
    YZ_A[-1].append(CC_[(2**(len(LLZZ_ ))-1+p)-1])
  return(chr(32).join([str.__call__().join(__)for __ in YZ_A]))

print(p(...,...,...*...,...==...,.../...,...,.../...,...,...-...,...+...,...+...,.../...,...,...-...,...+...,...+...,.../...,...-...,...-...,...-...,...@...,...*...,...^...,...-...,.../...,...!=...,...<=...,...%...,.../...,...,...-...,...,.../...,...,...-...,...+...,...*...,.../...,...-...,...,...*...,.../...))
#

Or all the overrides here

{"__sub__":AAAAA,"__mod__":lambda *a:-1,rf"{PA}add{AP}":_x_B,"__mul__": _x_B,"f":lambda m:[a is Ellipsis or a>=1 for a in m],"__UU9":list(),"__truediv__":lambda *A:1j,"__gt__":lambda *_:0,"imag":None,"__matmul__":lambda xX,Xx:3+3-3,fr"{PA}rox{PA}"[::-1]:lambda Zz,zZ:int(False)>True,"__ge__":GGENN}

which are a bit obvious

versed eagle
#

theres a lot of useless stuff going on in it

distant salmon
#

Here are three levels of "Do you know your python syntax?"

#

Level 1. Which of the following lines are valid?

(a) = 1
(a) = 1,
[a] = 1
[a] = 1,

Ans: || Line 1,2,4||

#

Level 2. Which of the following lines are valid?

[a,b] ,= [[1,2]]
() = ()
(,) = (,)
[] = []
[,] = [,]

Ans: ||Line 1,2,4||

#

Level 3. Which of the following lines are valid

*a   = ()
*a  ,= ()
(*a) = ()
[*a] = ()

Ans: || 2 and 4||

#

Bonus level: ||Is this valid: *[a,a] ,= (1,2)?||

arctic skiff
#

another bonus level: ||Tell the value of a and b in of: a,*b,=([*[1,2,3]],*[1,2,3])||

quartz wave
unique heath
torn agate
violet forge
earnest wing
#

since before 3.0 :)

fleet bridge
arctic skiff
#

the channel description itself states the point of this channel

violet forge
#

CURSECURSE!!!!

fleet bridge
unreal echo
#

!e Theres a couple too many for loops in here for my liking; does anyone have any ideas on how to reduce the tokens?

(PA:=str.__call__().join([chr(x)for(x)in[((None,sum((range.__call__(int.__call__((3-1j).real-1),7))),True)[1]-1)*10**1//2]*2])),(_x_B:=lambda A____,_B:(z:=(complex.__call__(*[9,2])-3j)).real%4),(AP:=PA),(AAAAA:=lambda __,_:(~int(_x_B(__,_)))),(GGENN:=lambda *a:-1),(ZZZ_ :=type("_yy", (), {"__sub__":AAAAA,"__mod__":lambda *a:-1,rf"{PA}add{AP}":_x_B,"__mul__": _x_B,"f":lambda m:[a is Ellipsis or a>=1 for a in m],"__UU9":list(),"__truediv__":lambda *A:1j,"__gt__":lambda *_:0,"imag":None,"__matmul__":lambda xX,Xx:3+3-3,fr"{PA}rox{PA}"[::-1]:lambda Zz,zZ:int(False)>True,"__ge__":GGENN})),(CC_:="ETIANMSURWDKGOHVF L PJBXCYZQ"),(YZ_A:=[[]])
def p(*x:__import__("typing").Any,_:__import__((CC:="fishhook")).hook.cls(type(...))(ZZZ_)={}):
  for(eEE_,_ALz )in(ne:=enumerate)(x):
    if(_ALz.imag)or _ALz>2:ZZZ_.__UU9=[*ZZZ_.__UU9,ZZZ_.f(list(x[(tt:=len(sum(ZZZ_.__UU9,start=[])))+len(list(filter(bool,ZZZ_.__UU9))) if(ZZZ_.__UU9)else 0:eEE_])),*list(filter(lambda m:isinstance(m,list),[None if not(not _ALz.imag and _ALz>2)else[]]))]
  for(LLZZ_)in ZZZ_.__UU9:
    if(YZ_A.append([])or(p:=0)or LLZZ_ ==[]):continue
    for(M_SA)in([*LLZZ_,*([True]if(z:=YZ_A.pop())else[])] ):p=2*p+(int(M_SA)-1)*-1
    YZ_A[-1].append(CC_[(2**(len(LLZZ_ ))-1+p)-1])
  return(chr(32).join([str.__call__().join(__)for __ in YZ_A]))

print(p(...,...,...*...,...==...,.../...,...,.../...,...,...-...,...+...,...+...,.../...,...,...-...,...+...,...+...,.../...,...-...,...-...,...-...,...@...,...*...,...^...,...-...,.../...,...!=...,...<=...,...%...,.../...,...,...-...,...,.../...,...,...-...,...+...,...*...,.../...,...-...,...,...*...,.../...))
night quarryBOT
#

@unreal echo :white_check_mark: Your 3.12 eval job has completed with return code 0.

HELLO WORLD
unreal echo
#

!timeit

(PA:=str.__call__().join([chr(x)for(x)in[((None,sum((range.__call__(int.__call__((3-1j).real-1),7))),True)[1]-1)*10**1//2]*2])),(_x_B:=lambda A____,_B:(z:=(complex.__call__(*[9,2])-3j)).real%4),(AP:=PA),(AAAAA:=lambda __,_:(~int(_x_B(__,_)))),(GGENN:=lambda *a:-1),(ZZZ_ :=type("_yy", (), {"__sub__":AAAAA,"__mod__":lambda *a:-1,rf"{PA}add{AP}":_x_B,"__mul__": _x_B,"f":lambda m:[a is Ellipsis or a>=1 for a in m],"__UU9":list(),"__truediv__":lambda *A:1j,"__gt__":lambda *_:0,"imag":None,"__matmul__":lambda xX,Xx:3+3-3,fr"{PA}rox{PA}"[::-1]:lambda Zz,zZ:int(False)>True,"__ge__":GGENN})),(CC_:="ETIANMSURWDKGOHVF L PJBXCYZQ"),(YZ_A:=[[]])
def p(*x:__import__("typing").Any,_:__import__((CC:="fishhook")).hook.cls(type(...))(ZZZ_)={}):
  for(eEE_,_ALz )in(ne:=enumerate)(x):
    if(_ALz.imag)or _ALz>2:ZZZ_.__UU9=[*ZZZ_.__UU9,ZZZ_.f(list(x[(tt:=len(sum(ZZZ_.__UU9,start=[])))+len(list(filter(bool,ZZZ_.__UU9))) if(ZZZ_.__UU9)else 0:eEE_])),*list(filter(lambda m:isinstance(m,list),[None if not(not _ALz.imag and _ALz>2)else[]]))]
  for(LLZZ_)in ZZZ_.__UU9:
    if(YZ_A.append([])or(p:=0)or LLZZ_ ==[]):continue
    for(M_SA)in([*LLZZ_,*([True]if(z:=YZ_A.pop())else[])] ):p=2*p+(int(M_SA)-1)*-1
    YZ_A[-1].append(CC_[(2**(len(LLZZ_ ))-1+p)-1])
  return(chr(32).join([str.__call__().join(__)for __ in YZ_A]))

print(p(...,...,...*...,...==...,.../...,...,.../...,...,...-...,...+...,...+...,.../...,...,...-...,...+...,...+...,.../...,...-...,...-...,...-...,...@...,...*...,...^...,...-...,.../...,...!=...,...<=...,...%...,.../...,...,...-...,...,.../...,...,...-...,...+...,...*...,.../...,...-...,...,...*...,.../...))
night quarryBOT
#

@unreal echo :white_check_mark: Your 3.12 timeit job has completed with return code 0.

1 loop, best of 5: 634 usec per loop
unreal echo
#

!timeit
print('HELLO WORLD')

night quarryBOT
#

@unreal echo :white_check_mark: Your 3.12 timeit job has completed with return code 0.

500000 loops, best of 5: 694 nsec per loop
unreal echo
#

Smh

arctic skiff
#

TIL: SyntaxError: assignment expression cannot be used in a comprehension iterable expression

distant salmon
#

It's a classic

#

Output from the print: ||True||

unreal echo
#

Operator precedencd

distant salmon
unreal echo
#

!e
print('eq is ran')==print('2') in [print('list')]

night quarryBOT
#

@unreal echo :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | eq is ran
002 | 2
003 | list
unreal echo
#

Ye

distant salmon
#

!e

print( False ==  False  in [False] )
print((False ==  False) in [False] )
print( False == (False  in [False]))
night quarryBOT
#

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

001 | True
002 | False
003 | False
arctic skiff
#

the explanation I found is that it does this

(False == False) and (False in [False])```
distant salmon
#

I wonder if anyone has actually intensionally used this "feature"

arctic skiff
#

I am gonna now

#
>>> [_ for _ in[(__:=[...]), ...]] 
  File "<stdin>", line 1
SyntaxError: assignment expression cannot be used in a comprehension iterable expression
>>> ```why though?
low lynx
distant salmon
#

I know of doing things like
n>1<f(n-1)

#

to only call f if n>1

low lynx
#

i've seen stuff like 0<x in[some list comp]

arctic skiff
#

!epy eval(''.join((__:=[chr(_+95)for _ in[*([0]*2),10,14,17,16,19,21,*([0]*2)]])+[chr(_+95)for _ in[~54,~55,*([0]*2),9,6,*([13]*2),16,*([0]*2),~55,~53]]+[''.join([chr(_+95)for _ in[~48,14,2,10,15,~54,~53]])if eval(''.join(__+[chr(_+95)for _ in[~54,~55,20,26,20,~55,~53]])).version_info.minor>10 else'']))

night quarryBOT
#

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

Hello world!
arctic skiff
#

realized it can't work on 3.7

#

gotta fix

dire spade
#

print("Hello".encode())

#

!e

hi = "Hello".encode()
print(hi)
#

H

#

!e

hi = "Hello".encode()
print(hi)
night quarryBOT
#

@dire spade :white_check_mark: Your 3.12 eval job has completed with return code 0.

b'Hello'
wheat river
#

!e

print(*b'Hello')
night quarryBOT
#

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

72 101 108 108 111
magic wraith
torn cypress
#

a flappy bird clone I wrote a while ago for a jam (requires pygame(-ce))

from time import*
from pygame import*
init()
d=display
c=draw.rect
r=Rect
t=l=j=0
while not event.get(256):
 s=d.set_mode((500,300));event.clear();k=key.get_pressed()
 if l:
  if t%66==0:o+=[m:=r(550,y:=time_ns()%11*-20,50,200),m.move(0,300)]
  j+=1;p.y+=min(j,9);c(s,-1,p);t+=1;l=p.collidelist(o+[(0,0,70,300)])==len(o)
  for a in o:a.x-=3;c(s,-1,a)
  if k[32]:j=-8
 else:s.blit(Font().render(str(t),(l:=k[13])and(t:=0),"red"),p:=r(40,90,10,10));o=[]
 o=o[-6:];d.flip();time.wait(33)
#

(it was TweetTweetJam8 and the goal was to fit a game within 500 characters of code, mine is 499)

fleet bridge
#

i believe removing r=Rect will save a char

torn cypress
#

only two r usages, huh, alr, nicely spotted

distant salmon
#

t%6==0 is the same as t%6<1

fleet bridge
#

y:=time_ns()%11*-20 is not being used after, so you can remove y:=

#
 else:s.blit(Font().render(str(t),(l:=k[13])and(t:=0),"red"),p:=r(40,90,10,10));o=[]
 else:s.blit(Font().render(str(t),0,"red"),p:=r(40,90,10,10));o=[];l=k[13];t=0
#
str(t)
f'{t}'
distant salmon
fleet bridge
#
  if k[32]:j=-8
j=[j,-8][k[32]]
``` same amount, if you move `j=[j,-8][k[32]]` to other statements
distant salmon
#

so y+=min(j,9) could just be removed

fleet bridge
#

it is p.y+=...

#

it is moving the player

#

r(40,90,10,10) -> r(40,90,9,9)
shrink player by 1px and save 2 chars 🙂

fleet bridge
#

o=o[-6:]; is not important
i doubt anyone will run out of memory because of infinite number of rects

#
  # if k[32]:j=-8
  j-=k[32]*2
``` this change makes game a lot funnier
fleet bridge
#
from time import*
from pygame import*
init()
d=display
c=draw.rect
r=Rect
t=l=j=0
while not event.get(256):
 s=d.set_mode((500,300));event.clear();k=key.get_pressed()
 if l:
  if t%66<1:o+=[m:=r(550,time_ns()%11*-20,50,200),m.move(0,300)]
  j=[j+1,-8][k[32]];p.y+=min(j,9);c(s,-1,p);t+=1;l=p.collidelist(o+[(0,0,70,300)])==len(o)
  for a in o:a.x-=3;c(s,-1,a)
 else:s.blit(Font().render(str(t),0,"red"),p:=r(40,90,9,9));o=[];l=k[13]
 d.flip();time.wait(33)
``` 456
#

not sure what event.clear(); was doing
i removed it and everything seems fine

fleet bridge
#

i also tried to remove init() by doing set_mode before other stuff (it inits some parts of pygame internally)
but it doesnt initialize fonts, so it didnt work

#
from time import*
from pygame import*
init()
d=display
c=draw.rect
t=l=j=0
while not event.get(256):
 s=d.set_mode((500,300));k=key.get_pressed()
 if l:
  if t%66<1:o+=[m:=Rect(550,time_ns()%11*-20,50,200),m.move(0,300)]
  j=[j+1,-8][k[32]];p.y+=min(j,9);c(s,-1,p);t+=1;l=p.collidelist(o+[(0,0,70,300)])==len(o)
  for a in o:a.x-=3;c(s,-1,a)
 else:s.blit(Font().render(str(t),0,"red"),p:=Rect(40,90,9,9));o=[];l=k[13];t=0
 d.flip();time.wait(33)
``` 445
fleet bridge
fleet bridge
# fleet bridge ```py else:s.blit(Font().render(str(t),(l:=k[13])and(t:=0),"red"),p:=r(40,90,10...

tried to apply same idea, but saved only one char:

# 427
from pygame import*
init()
d=display
c=draw.rect
t=l=j=0
while not event.get(256):
 s=d.set_mode((500,300));k=key.get_pressed()
 if l:
  if t%66<1:o+=[m:=Rect(550,p.y%9*-25,50,200),m.move(0,300)]
  j=[j+1,-8][k[32]];p.y+=min(j,9);c(s,-1,p);t+=1;l=p.collidelist(o+[(0,0,70,300)])==len(o)
  for a in o:a.x-=3;c(s,-1,a)
 else:s.blit(Font().render(str(t),(l:=k[13])and(t:=0),"red"),p:=Rect(40,90,10,10));o=[]
d.flip();time.wait(33)

# 426
from pygame import*
init()
d=display
c=draw.rect
x=t=l=j=0
while not event.get(256):
 s=d.set_mode((500,300));k=key.get_pressed()
 if l:
  if t%66<1:o+=[m:=Rect(550,p.y%9*-25,50,200),m.move(0,300)]
  j=[j+1,-8][k[32]];p.y+=min(j,9);c(s,-1,p);t+=1;l=p.collidelist(o+[(0,0,70,300)])==len(o);x=t
  for a in o:a.x-=3;c(s,-1,a)
 else:s.blit(Font().render(str(x),0,"red"),p:=Rect(40,90,10,10));o=[];t=l=k[13]
 d.flip();time.wait(33)
#

also from time import* is removed, random columns are generated by p.y%9*-25 instead of time_ns()%11*-20

#

oh, using -1 to produce white color is smart

bright valve
#
w=input().upper()
print("Impossible"if w[0]in"AEIOU"else w[1:]+w[0]+"UM")```
#

how would you golf it further?

#

if first letter is a vowel print impossible, if not, print the word with the first letter at the end + "UM"

distant salmon
bright valve
#

!e

w="Latin".upper()
print([w[1:]+w[0]+"UM","Impossible"][w[0]in"AEIOU"])
night quarryBOT
#

@bright valve :white_check_mark: Your 3.12 eval job has completed with return code 0.

ATINLUM
bright valve
#

nice

torn cypress
#

it's supposed to be as much a full game as possible

fleet bridge
#

ok, i didn't know that
i never used .get(etype), only .get(), and i believe you dont have to clear event queue in that case

distant salmon
torn cypress
#

it removes all the events you're getting

formal spear
serene coral
#

!e

while True: print((lambda ch, d: ((d.update({'m1':[], 'm2':[], '+':[[],[]], '-':[[],[]]})), [(d['m1'].append([int(i) for i in list(input(f"m1 line {i}:").replace(" ", ''))])) for i in range(2)], [(d['m2'].append([int(i) for i in list(input(f"m2 line {i}:").replace(" ", ''))])) for i in range(2)], ([d['+'][i].extend([j+d['m2'][i][0], k+d['m2'][i][1]]) for i,(j,k) in enumerate(d['m1'])]), ([d['-'][i].extend([abs(j-d['m2'][i][0]), abs(k-d['m2'][i][1])]) for i,(j,k) in enumerate(d['m1'])]), ("Sum:\n" + " ".join([str(i) for i in d['+'][0]]) + '\n' + " ".join([str(i) for i in d['+'][1]]) + '\n' + 'Difference:\n' + " ".join([str(i) for i in d['-'][0]]) + "\n" + " ".join([str(i) for i in d['-'][1]]))) if ch=='a' else (((d.update({'tm':[]})), [(d['tm'].append([int(i) for i in list(input(f"line {i}:").replace(" ", ''))])) for i in range(2)], (d.update({'tf':[[d['tm'][j][i] for j in range(2)] for i in range(2)]})), ("Original:\n" + " ".join([str(i) for i in d['tm'][0]]) + '\n' + " ".join([str(i) for i in d['tm'][1]]) + '\n' + 'Transpose:\n' + " ".join([str(i) for i in d['tf'][0]]) + "\n" + " ".join([str(i) for i in d['tf'][1]]))) if ch == 'b' else (quit() if ch=='q' else (None,'Invalid Input'))))(ch=input("Enter Choice:\n(A)For Sum and Difference\n(B)For Transpose\n(Q)To Quit\n>>>").lower()[0], d={})[-1])
arctic skiff
#

also why does your code have lots of whitespaces

#

though can you tell what does this do?

magic wraith
torn cypress
#

that is a sus link

#

is it black the formatter black.vercel.app?