#esoteric-python

1 messages ยท Page 140 of 1

sick hound
#

actually no

floral meteor
#

I've done it before

sick hound
#

i have a game idea

floral meteor
#

it's satisfying

#

the cat adoption scraper is very satisfying to run

#

a bit vague

sick hound
#

actually eys

#

am going to do cat adoption garfield scraper

floral meteor
#

XD

west cipher
sick hound
#

i kinda want to do something esoteric tho

floral meteor
#

I think last time I ran the script I got a 14 pounds cat

sly root
#

!e ```py
def ():
(:=[,import('collections').defaultdict(int),0,0,0,import('sys').stdin.read,{}])[-1]|={'+':lambda:([2],*[0for [1][[2]]in[([1][[2]]+1)%256]]),'-':lambda:([2],[0for [1][[2]]in[([1][[2]]-1)%256]]),'<':lambda:([2]-1,0),'>':lambda:([2]+1,0),'.':lambda:(_[2],[0for{}[()]in[print(end=chr([1][[2]]))]]),',':lambda:([2],*[0for [1][[2]]in[ord(5)]]),'[':lambda:([2],not [1][[2]]),']':lambda:([2],-bool([1][[2]]))}
while [4]in range(len([0])):
([0for [3]in[[3]+([0][[4]]=='[')-([0][[4]]==']')]]if [3]else 0)
[[0for [i]in[
.setitem(i_,[-1].get([0][[4]],lambda:([2],0))())]]for i_ in range(2,5)if not [3]]
[0for [4]in[[4]+1-2*(
[3]<0)]]
return int(not [4]==len([0]))
_("++++++++++[>+++>++++>++++++++>+++++++++>++++++++++>+++++++++++>++++++++++++<<<<<<<-]>>>++++.>>++++.+.>+++++.<<<<<++.>>>>>+.<----.>-.+.<<<<<.>>>>+++.<+++++++.>>-.<<<<<.>>>++.>>----.<+++++.>+.<-.-------.>++++.<.-.<<<<.>>>>>-.++.<<..>+.>--..<+.>++.<++++++..>>+.<<<<<++++++.")

night quarryBOT
#

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

001 | Traceback (most recent call last):
002 |   File "<string>", line 8, in <module>
003 |   File "<string>", line 6, in _
004 | TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
west cipher
#

also so literally there is zero reason why you can't use walrus in the itterator part of a comprehension

#

which is reallllllllllly annoying

sick hound
#

hm yes

floral meteor
#
[_ for _ in (a:=[1, 2, 3])]
``` nope
```py
(lambda a:[_ for _ in a])((a:=[1,2,3]))
``` yes (edit: i made it  betterer)
sick hound
#

i am going to write code that writes more code that rhymes

sly root
floral meteor
#

remember one level up the else only evaluates if the if condtion returns false

#

i dont know if that's relevant to your issue though

sly root
#

alternative for if:... else:...

([...]if a else 0);([...]if not a else 0)
floral meteor
#
if a:
  this()
else:
  that()

to

[that,this][bool(a)]()
sly root
#

oh

#

nice

floral meteor
#

for more than two way comparison, use a dictionary instead

sly root
#

!e ```py
def ():
(:=[,import('collections').defaultdict(int),0,0,0,import('sys').stdin.read,{}])[-1]|={'+':lambda:([2],*[0for [1][[2]]in[([1][[2]]+1)%256]]),'-':lambda:([2],[0for [1][[2]]in[([1][[2]]-1)%256]]),'<':lambda:([2]-1,0),'>':lambda:([2]+1,0),'.':lambda:(_[2],[0for{}[()]in[print(end=chr([1][[2]]))]]),',':lambda:([2],*[0for [1][[2]]in[ord(5)]]),'[':lambda:([2],not [1][[2]]),']':lambda:([2],-bool([1][[2]]))}
while [4]in range(len([0])):[([0for [3]in[[3]+([0][[4]]=='[')-([0][[4]]==']')]]),[[0for [i]in[.setitem(i,[-1].get([0][[4]],lambda:([2],0))())]]for i_ in range(2,5)]][bool([3])];[0for [4]in[[4]+1-2*([3]<0)]]
return int(not [4]==len([0]))
_("++++++++++[>+++>++++>++++++++>+++++++++>++++++++++>+++++++++++>++++++++++++<<<<<<<-]>>>++++.>>++++.+.>+++++.<<<<<++.>>>>>+.<----.>-.+.<<<<<.>>>>+++.<+++++++.>>-.<<<<<.>>>++.>>----.<+++++.>+.<-.-------.>++++.<.-.<<<<.>>>>>-.++.<<..>+.>--..<+.>++.<++++++..>>+.<<<<<++++++.")

night quarryBOT
#

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

001 | Traceback (most recent call last):
002 |   File "<string>", line 5, in <module>
003 |   File "<string>", line 3, in _
004 | TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
floral meteor
#
if a:
  this()
elif b:
  that()
else:
  nope()

to

{bool(b):that,bool(a):this}.get(1,nope)()
#

three way comparison

#

what's the point of for i_ in range(2,5)?

floral meteor
#

which has a length of two, not three

#

slices work the same as ranges

#

i, t = (...)(i)
in the version with "normal" variables

floral meteor
#

!e ```py
print(1==True)
print({True:'Hello'}[1])

night quarryBOT
#

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

001 | True
002 | Hello
sick hound
#

i meant meant more "how can i run it"

sick hound
#

i has funny idea

#

one person writes code

#

the other person estorifies it

#

then the first person esoteries it more

#

and so on

west cipher
#

print("hi")

sick hound
#

print(f"{''.join([chr(n+103) for n in range(1,3)])}")

rapid sparrow
#

we picked up some more followers ๐Ÿฅณ

sick hound
#

yay

#

the cult grows

umbral prism
#

i kept googling everywhere,
my brain is stupid to understand the walrus

west cipher
#

inline variable set

umbral prism
#

means ?

#

oh

sly root
umbral prism
#

got it

#

thanks

west cipher
#

!e q = (a := 5) + 2
print(q)
print(a)

night quarryBOT
#

@west cipher :warning: Your eval job has completed with return code 0.

[No output]
west cipher
#

what

#

oh

#

!e py q = (a := 5) + 2 print(q) print(a)

night quarryBOT
#

@west cipher :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     `py
003 |     ^
004 | SyntaxError: invalid syntax
west cipher
#

ffs

umbral prism
#

!e ```py
for (a := 5) in range(5):
print(a)

night quarryBOT
#

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

001 |   File "<string>", line 1
002 |     for (a := 5) in range(5):
003 |          ^^^^^^
004 | SyntaxError: cannot assign to named expression
umbral prism
#

e

west cipher
#

!e

q = (a := 5) + 2
print(q)
print(a)
night quarryBOT
#

@west cipher :white_check_mark: Your eval job has completed with return code 0.

001 | 7
002 | 5
west cipher
#

finally

umbral prism
#

thanks

west cipher
#

i haven't slept in too long

umbral prism
#

"inline variable set" was enough lol

sly root
night quarryBOT
#

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

001 | 0 5
002 | 1 5
003 | 2 5
004 | 3 5
005 | 4 5
umbral prism
arctic elm
#

fcaas - fat cats as a service

sick hound
#

i cant find any cat adoption sites that state the weight of the cat

#

i want to squish that fat cat ):

west cipher
# sick hound `print(f"{''.join([chr(n+103) for n in range(1,3)])}")`

!e

from base64 import b64encode
from hashlib import sha256
from sys import exit

while 'q' in globals() or (q := []) or 1:
    q += [w := memoryview(bytes()), q := sha256((w:=str(b64encode(bytes([((a:=int(str(w)[-8:-1],16)%2**16)//(2**8)),(a+4)%2**8][::-1]))).lower()[2:4]).encode('utf-8')).hexdigest()=="8f434346648f6b96df89dda901c5176b10a6d83961dd3c1ac88b59b2dc327aa4" and (print(w) or exit(0))]
#

what

sly root
#

exit(0)

#

no

#

i mean u had from sys import exit

night quarryBOT
#

@west cipher :white_check_mark: Your eval job has completed with return code 0.

hi
west cipher
#

ok there

#

epic

#

@sick hound your turn now xddd

sly root
#

now i somewhy need to golf it

sick hound
#

ok

sly root
night quarryBOT
#

@sly root :warning: Your eval job timed out or ran out of memory.

[No output]
sly root
#

lol

west cipher
#

xd

sick hound
#

bruh

#

i'm just going to not edit anything you written since i dont want my computer to like
explode
or something

sly root
#

!e py def _(_): (_:=[_,__import__('collections').defaultdict(int),0,0,0,__import__('sys').stdin.read,{}])[-1]|={'+':lambda:(_[2],*[0for _[1][_[2]]in[(_[1][_[2]]+1)%256]]),'-':lambda:(_[2],*[0for _[1][_[2]]in[(_[1][_[2]]-1)%256]]),'<':lambda:(_[2]-1,0),'>':lambda:(_[2]+1,0),'.':lambda:(_[2],*[0for{}[()]in[print(end=chr(_[1][_[2]]))]]),',':lambda:(_[2],*[0for _[1][_[2]]in[ord(_[5](1))]]),'[':lambda:(_[2],not _[1][_[2]]),']':lambda:(_[2],-bool(_[1][_[2]]))} while _[4]in range(len(_[0])):[([0for _[3]in[_[3]+(_[0][_[4]]=='[')-(_[0][_[4]]==']')]]),[[0for _[i_]in[_.__setitem__(i_,_[-1].get(_[0][_[4]],lambda:(_[2],0))())]]for i_ in range(2,4)]][bool(_[3])];[0for _[4]in[_[4]+1-2*(0>_[3]if _[3]is not None else 1)]] return int(not _[4]==len(_[0])) _("++++++++++[>+++>++++>++++++++>+++++++++>++++++++++>+++++++++++>++++++++++++<<<<<<<-]>>>++++.>>++++.+.>+++++.<<<<<++.>>>>>+.<----.>-.+.<<<<<.>>>>+++.<+++++++.>>-.<<<<<.>>>++.>>----.<+++++.>+.<-.-------.>++++.<.-.<<<<.>>>>>-.++.<<..>+.>--..<+.>++.<++++++..>>+.<<<<<++++++.")

night quarryBOT
#

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

[No output]
sly root
#

still not works

west cipher
#

xdd

#

gg

sick hound
#

wait i just realised what its doign

#

thats literally insane

#

jesus christ

#

omg thats literally insane

west cipher
#

my thing?

sick hound
#

yes

west cipher
#

i just kept hashing memory addresses until I got a hi lol

sick hound
#

honestly i dont really see any way i could make this worse unless i completely rewrote it

west cipher
#

make a neural network that detects letters, hash something builtin and that when passed into some function that draws stuff makes the neural network guess "hi"

sick hound
#

perhaps

#

im going to stick with the way you esesntially brute forced it to write h

#
count_a,count_b,power_a,power_b = 200,200,200,200
for a1 in range(count_a):
    for a2 in range(count_b):
        for b1 in range(power_a):
            for b2 in range(power_b):
                try:
                    c = chr(((a1**b1)*(a2**b2)))
                except:
                    pass
                if c == "h":
                    print(f"success\n{a1}^{b1}|{a2}^{b2}")

i think i am getting somewhere

#

you see its esoteric if its un feasible anything will ever be able to run it

west cipher
#

!e

from itertools import product
q = 200
for a1, a2, b1, b2 in product(range(q), repeat=4):
  print(a1)
night quarryBOT
#

@west cipher :x: Your eval job has completed with return code 143 (SIGTERM).

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

Full output: too long to upload

west cipher
#

xd

sick hound
#

all i need to do is convert this to a list comp, create 2 combinations of characters instead, and then replace every number with stupid bullshit

#

so

simple crystal
severe canyon
simple crystal
#

answers are revealed when the contest ends

#

though late solutions are accepted for no points as well

#

I'm bracing myself for when someone submits a 50 byte solution and I die inside

#

probably lyndon

severe canyon
#

hehe

sly root
#

can someone in this channel test python >asm translation?

#
echo "print('Hello World!')" > hello.pyx

cython -l -t -f -v -p --gdb -D -a --line-directives -3 --lenient hello.pyx

gcc -O -fverbose-asm -S $(pkg-config --cflags --libs python3) hello.c

gcc -c hello.s -o hello.o```
fleet bridge
#

gcc -O -fverbose-asm -S $(pkg-config --cflags --libs python3) hello.c
this line doesnt work

#
D:\_>gcc -O -fverbose-asm -S $(pkg-config --cflags --libs python3) hello.c
gcc: error: $(pkg-config: No such file or directory
gcc: error: python3): No such file or directory
gcc: error: unrecognized command line option '--cflags'
gcc: error: unrecognized command line option '--libs'
#

gcc -O -fverbose-asm -S "$(pkg-config --cflags --libs python3)" hello.c this also doesnt work

sly root
#

for me its -I/usr/include/python3.10

next flame
#

$() is bash syntax, you're trying to run it in cmd

sly root
#

@floral meteor do you have an esoteric version of with statement? i need to make listcomp with with expression

#
for m in i:
   with __import__("contextlib").suppress(AttributeError,IndexError):
    ...```
#
class structure:
 def __rs(s,exc,msg,*a,**kw):raise exc(msg,*a,**kw)
 def __init__(s,cls):s.__dc=__import__("copy").deepcopy;s.__cls=cls;s.__al=list(cls.__annotations__.items());cls.__cls=s.__cls;cls.__repr__=lambda s:"<structure %s, %s>"%(s.__cls.__name__,s.__f)
 def __call__(s,**i):__cls=s.__dc(s.__cls)();__cls.__f=i;return __cls if[setattr(__cls,kwn,kwi)if(type(kwi)==v)else s.__rs(Exception,"type mismatch, required %s, got %s"%(v,type(kwi),))if(k==kwn)else 0for(k,v)in s.__al for(kwn,kwi)in list(i.items())]is not None else None
 def __getitem__(s,i):
  __cls=s.__dc(s.__cls)();__cls.__f={}
  for m in i:
   with __import__("contextlib").suppress(AttributeError,IndexError):(_nop:=lambda s,*a:0)(setattr(__cls,f[0],m),__cls.__f.update({f[0]:m}))if((f:=s.__al[(ix:=i.index(m))])[1]==type(m))else s.__rs(Exception,"type mismatch, required %s, got %s"%(f[1],type(m)))setattr(__cls,nf[0],None)if getattr(__cls,(nf:=s.__al[ix+1])[0])is not None else 0
  return __cls```
sly root
potent comet
#

Well, a with statement is mostly syntactic sugar for a try-finally block.

finite blaze
#

Hey, I just made small copy of wordle

"[A] - Letter in correct place, (B) - Letter exists but it is in a wrong place, {C} - Letter does not exist."
import random as r
x,y,g=list(open('i')),"",0
z=r.choice(x)
while(y!=z.strip() and g<6):
 y,i,f=input()[:5],0,""
 if(len(y)>4):
  for _ in y:
   if y[i]==z[i]:f+=f"[{_}]"
   elif _ in z:f+=f"({_})"
   else:f+='{'+_+'}'
   i+=1
  print(f);g+=1
print(f"{g}/6")

any ideas how to golf it even more?

severe canyon
#

Does it support multiple of the same letter?

finite blaze
#

it should

#

not sure how it works in wordle tho

next flame
finite blaze
#

[*open('i')]

#

didn't know that one

next flame
#

227

import random as r
z,y,g=r.choice([*open('i')]),0,0
while y!=z.strip() and g<6:
 y,f=input()[:5],""
 if len(y)>4:
  for a,b in zip(y,z):
   f+=f"[{a}]"if a==b else f"({a})"if a in z else'{'+a+'}'
  print(f);g+=1
print(f"{g}/6")
finite blaze
#

wait

#

why y is a number?

next flame
#

it doesnt matter what the intial value is as it gets assigned an value within the loop

#

so we can save a char

finite blaze
#

ah i see

#

Can I somehow do something like

p=print()
#and then
p(x)
#

oh i can

#
import random as r
z,y,g,p=r.choice([*open('i')]),0,0,print
while y!=z.strip() and g<6:
 y,f=input()[:5],""
 if len(y)>4:
  for a,b in zip(y,z):
   f+=f"[{a}]"if a==b else f"({a})"if a in z else'{'+a+'}'
  p(f);g+=1
p(f"{g}/6")
#

still 227 chars ;p

earnest wing
#

space before and

finite blaze
#

226

earnest wing
#

no newline after for

finite blaze
#

and also from random import*

#
from random import*
z,y,g,p=choice([*open('i')]),0,0,print
while y!=z.strip()and g<6:
 y,f=input()[:5],""
 if len(y)>4:
  for a,b in zip(y,z):f+=f"[{a}]"if a==b else f"({a})"if a in z else'{'+a+'}'
  p(f);g+=1
p(f"{g}/6")
#

221

next flame
#
z,g,p=y=r.choice([*open('i')]),0,print

-2

finite blaze
#

what happened here

earnest wing
#

y can be assigned with anything at the start, so it's set to the 3-tuple

finite blaze
#

ah

#

thats cool

#

didn't know u can assign like this in python

#

(219chars)

#
from random import*
z,g,p=y=choice([*open('i')]),0,print
while y!=z.strip()and g<6:
 y,f=input()[:5],""
 if len(y)>4:
  for a,b in zip(y,z):f+=f"[{a}]"if a==b else f"({a})"if a in z else'{'+a+'}'
  p(f);g+=1
p(f"{g}/6")
#

i think there was even shorter way to import random

severe canyon
#

__import__('random') is longer

finite blaze
#

okay

severe canyon
#

or the same length actually

finite blaze
#

code gore

#

What does that mean?

severe canyon
#

code crafted with love blood sweat and tears

severe canyon
finite blaze
#

we caaan assume

severe canyon
#

also, z.strip() can be made into z[:5] if you only care about length

finite blaze
#

ah yeah, thats true

#

i just wanted to get rid of new line char

severe canyon
#

yeah, this does that aswell... assuming correct input :)))

finite blaze
#

down to 215

#

(with len(y)>4)

severe canyon
#

202

from random import*
z,g,p=y=choice([*open('i.txt')]),0,print
while y!=z[:5]and g<6:
 y=input()[:5]
 if len(y)>4:p(*[f"[{a}]"if a==b else f"({a})"if a in z else'{'+a+'}'for a,b in zip(y,z)]);g+=1
p(f"{g}/6")
#

outputs the result with spaces tho:

[h] [e] [l] [l] [o]
#

like this

finite blaze
#

Does not work

#

nvm

#

.txt

severe canyon
#

oh

#

yeah

#

then -4 chars

finite blaze
#

without .txt it is 202

severe canyon
#

oh yeah yeah yeah

#

mb

#
y=input()[:5]
 if len(y)>4:

to this

y=input()
 if len(y)=5:
#

is -4 chars

finite blaze
#

need to be ==5

severe canyon
finite blaze
#

I wonder how people on code.golf get something like 100 chars but 95 bytes

fast smelt
#

back to the old for-loop and printing, this is 199:

from random import*
z,g,p,w=y=choice([*open('i')]),0,print,"{}[]()"
while y!=z.strip()and g<6:
 y,f=input()[:5],""
 for a,b in zip(y,z):h=w[2*(a==b)+2*(a in z):];f+=h[0]+a+h[1]
 p(f);g+=1
p(f"{g}/6")
finite blaze
#

and it looks better

#

I don't like these long lines

#

thats some black magic

#

w[2*(a==b)+2*(a in z):]

fast smelt
#

yea i wanted to get rid of the if-else-if-else and all the extra quotes and f-string {} so i focused mostly on that region.
That's what i came up with ๐Ÿ˜›

finite blaze
#

mind explaining how it works?

fast smelt
#

The original idea was that h becomes {}, [] or () and f+=h[0]+a+h[1] could be used.

To do that, instead of storing 3 strings,i used 1 longer one to save on quotes w="{}[]()"
And then I need string splicing h=w[0:2] for {} etc.
Because we only do h[0] and h[1] we don't need the second number in the splice, if h is equal to "{}[]()" then it would still print {} which is fine.

So all that's left is calculating the right digit for h=w[0:]

The last thing you need to know is that a boolean automatically casts to 0 or 1 when interacting with numbers. So 2* True is 2, and 2*false is 0.

And then it's just some clever boolean maths really.

#

If the letter is wrong, it will be 2*False + 2*False which is 0, and the string will be "{}"
If the letter is not wrong but in the string it's 2*False + 2*True which is 0 +2, which will become ""
And lastsly if all is good it calculates to 4 and the string will be ()

finite blaze
#

okey

#

gotta make notes

#

for golfing

#

cuz there is so many cool tricks

#

boolean automatically casts to 0 or 1 when interacting with numbers. So 2* True is 2, and 2*false is 0.

severe canyon
#

178 with funky printing again:

from random import*
z,g,p,w=choice([*open('i')]),1,print,"{[(}])"
while(y:=input()[:5])!=z[:5]and g<6:p(*[(h:=w[(a==b)+(a in z):])[0]+a+h[3]for a,b in zip(y,z)]);g+=1
p(f"{g}/6")
fast smelt
#

ahhh the new := i would've never thought of that one.

severe canyon
finite blaze
#

:=

#

thats something new

#

good to know that it exists

#

i needed something like this before

severe canyon
fast smelt
#

You do sadly miss the last print/evaluation with the y:= tho

severe canyon
#

i dont mind :)

#

told you it was funky printing xD

severe canyon
finite blaze
#

And I see that you skipped input length check

severe canyon
#

i mean.. it still works, and gives the correct information from a 3 letter word

finite blaze
#

true true

severe canyon
#

removing the w variable gives -4

finite blaze
#

w variable?

#

"{[(}])"

severe canyon
#

instead of:

w="{[(}])"
w[]

you can just do

"{[(}])"[]
#

indexing directly

finite blaze
#

okey

#
from random import*
z,g,p=choice([*open('i')]),1,print
while(y:=input()[:5])!=z[:5]and g<6:p(*[(h:="{[(}])"[(a==b)+(a in z):])[0]+a+h[3]for a,b in zip(y,z)]);g+=1
p(f"{g}/6")
#

Like this?

severe canyon
#

ye

finite blaze
#

then it doesn't work correctly

severe canyon
#

works on my end

finite blaze
#
abcde
{a} {b} {c} {d} [e]
eeeee
[e] [e] [e] (e) [e]
#

Can you send your code?

#

So I can compare

severe canyon
#
from random import*
z,g,p=choice([*open('i')]),1,print
while(y:=input()[:5])!=z[:5]and g<6:p(*[(h:="{[(}])"[(a==b)+(a in z):])[0]+a+h[3]for a,b in zip(y,z)]);g+=1
p(f"{g}/6")
finite blaze
#

yeah

#

there is an issue

severe canyon
#

whats the matter?

finite blaze
#

"[A] - Letter in correct place, (B) - Letter exists but it is in a wrong place, {C} - Letter does not exist."

severe canyon
#

use "{([})]" then

finite blaze
#

yeah, now it works correctly

severe canyon
#

last improvement then im gone:

replacing with a map lambda is 1 char shorter:

*[(h:="{([})]"[(a==b)+(a in z):])[0]+a+h[3]for a,b in zip(y,z)]

*map(lambda a,b:(h:="{([})]"[(a==b)+(a in z):])[0]+a+h[3],y,z)
finite blaze
#

what does the * do?

severe canyon
#

basically makes the output into a tuple, which can be printed.. instead of it being a map function and printing as: <map object at 0x7f90db2c8640>

#

someone else here probably has a better explanation

finite blaze
#

nah, i understood

violet agate
#

Vapoursynth - Installation of correct version for Python 3.6.9:
Running Ubuntu 18.04 on a remote server with default Python 3.6.9. Need the 18.04 for XFCE4+X2GO to work smoothly. Problem: I need a way to install the correct version of Vapoursynth for this set-up. Installing the latest version of vs (R57) leads to problems when trying to install vs plugins, for eg. ffms2

severe canyon
#

yes.

tardy grail
simple crystal
#

lol it's easy to spend all day optimizing

tardy grail
#

i got it down to 77 with some exec and fstring nonsense but I have no idea how you guys got like 71/72

simple crystal
#

I had to give up and get to work

#

lyndon is a beast

#

I am excited to see what they did tho I hope it isn't an easy trick I missed somehow

restive void
#

New in terrible-ideas: slicing, but with floats!

>>> from terrible_ideas import float_slicing
>>> "wat"[0.5:]
'vat'
#

at the moment this is done in a dumb, hardcoded way, but maybe I could draw the relevant character with Pillow, slice it to the nearest pixel and then find the closest character ๐Ÿค”

rugged sparrow
#

thats awful and amazing

severe canyon
#

what the

#

sry

#

vhat the

rugged sparrow
#

@restive void in theory you could do it for arbitrary containers too by taking the item, converting to string, passing to pillow, attempting to parse back into string, then call constructor of the item on the string

#

so that [8][0.5:] -> [3]

tardy grail
#

finally, intuitive slicing

restive void
#

:D

restive void
finite blaze
#
>>> 'o'[0.5:]
'โ†„'
fleet bridge
#
>>> 'o'[:0.5]
'c'
restive void
#

ask @rugged sparrow, 75% of that lib is fishhook

fleet bridge
#
>>> '8'[:,:0.5]
'o'
``` slicing in vertical direction
finite blaze
#
>>> 'E'[0.5:]
'โ‰ก'
restive void
fleet bridge
#
>>> '='[0.5]
':'
restive void
#

at the moment, it works only with a few characters and only with .5

fleet bridge
#

>>> aa * 0.5
a

finite blaze
#

does it need to serve any purpose?

fleet bridge
#

>>> a + b
ab

#

you can return range(self), it is faster

restive void
#
while True:
   bre + (e if False else ak)
```?
fleet bridge
#

lol

#

modify globals() to make break and continue variables
when you try access this variable from globals(), it breaks or continues

finite blaze
#
x = 1

def func1():
  print("1")

def func2():
  print("2")

def func3():
  print("3")

while x <= 3:
  func + x + ()
  x++
fleet bridge
#
for i in range(3):
    func{i}()
restive void
#

Surely you mean ffunc{i}()

#

as in an f-function

earnest wing
#

You could even define your own dunder __fraction__(self, fraction: float)

finite blaze
#

i++

#

i--

earnest wing
#

Then you can implement fractional slicing for arbitrary Sequence types

finite blaze
#

it will save one char when golfing
i+=1

restive void
#

When f-strings came out, I built "f-lists" and "f-tuples" :D

restive void
earnest wing
#

no empty f-lists pensiveline

fleet bridge
#

f{1,2,3} - proposed syntax for frozensets

finite blaze
#

glad that u undid the undoings

earnest wing
#

whatever

#

add new dunders for everything

#

it's part of the style guide

finite blaze
#

simple regex

#

[abc]\+\+$

fleet bridge
#

why not #def syntax?

#

or ##def

#

it is valid syntax, so it will not confuse python-related tools (formatters + type-checkers)

analog shadow
#

!e

def f(n):
    try:
        1 // n
        f(n - 1)
    except ZeroDivisionError:
        1 // 0

f(900)
night quarryBOT
#

@analog shadow :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 3, in f
003 | ZeroDivisionError: integer division or modulo by zero
004 | 
005 | During handling of the above exception, another exception occurred:
006 | 
007 | Traceback (most recent call last):
008 |   File "<string>", line 4, in f
009 |   File "<string>", line 6, in f
010 | ZeroDivisionError: integer division or modulo by zero
011 | 
... (truncated - too many lines)

Full output: too long to upload

lofty rapids
#

dear god what did I created:

def cleanDICT(Config):
  keys = []
  values = []
  tuples = []

  for key in Config.keys():
    keys.append(key)

  for value in Config.values():
    values.append(value)

  for x in range(0, len(Config)):
    tuples.append((keys[x], values[x]))
  return tuples

from replit import db # this works for replit users

results = []

test_dicts = [{'test1': 90}, {'test2': 89}, {'test3': 87}]
for test in test_dicts:
  test = cleanDICT(test)
  results.append(test)
  
for result in results:
  for key, value in result:
   db[key] = value
#

for viewing database on Replit:

from replit import db

for num, key in enumerate(db.keys()):
  print(num, key)

for num, val in enumerate(db.values()):
  print(num, val)
floral meteor
sly root
#

nice

#
namespace Test:
  class abcdef:
    constructor(self):
      pass;
    
    self::onCall(self):
      <--("hello world");

Test::abcdef test();
test();```
#

โฏ py comp.py test.py --compile

#

preprocessed output:

import rich,_io
rich_print=getattr(rich,"print")
__dump__,__getch__=lambda*args:rich_print(*args),lambda*args,**kwargs:input(*args,**kwargs)
class Test:
 class abcdef:
  def __init__(self):
   pass
  def __call__(self):
   __dump__("hello world")
test:Test.abcdef=Test.abcdef()
test()
โฏ ./test.o
hello world```
#

btw compiling is done using cython and gcc

#

it just gets down to asm and then compiles it

#

regex for matching c-like function definitions: ((\ |\t?)+(((\w+)((?:\:\:\w+)?)+)\ (.*)(\((.*)\))))

#

regex for matching rust-like decorators: (((\ +)?|(\t+)?)\#\[(.*)\])

#

for matching c-like variable definitions: ((\ |\t?)+((\w+((?:\:\:\w+)?)+)\ (\w+)\ ?\=\ ?(.*);))

#

for matching c-like type annotations (class initializations): ((\ |\t?)+(((\w+)((?:\:\:\w+)?)+)\ (\w+)(\((.*)\));))

sly root
sly root
sly root
umbral prism
#

What is difference between cython and cpython ?

sly root
umbral prism
#

Ah i see.

floral meteor
#

how just make the preprocessor initialise
a, i, tab = {0:0}, 0, 0
then translate brainfuck characters to their python counterparts, using tab to keep track of the indent level
so that the translation of

print("Hello World!")

to brainfuck:

++++++++++[>+++>+++++++>++++++++>++++++++++>+++++++++++<<<<<-]>>++.>>+.+++++++..>+.<<<<++.>>+++++++.>>.+++.<.--------.<<<+.

translates to

a, i = [0,0,0,0,0,0], 0
a[i] = a[i] + 10 % 256
while a[i]:
  i += 1
  a[i] = a[i] + 3 % 256
  i += 1
  a[i] = a[i] + 7 % 256
  i += 1
  a[i] = a[i] + 8 % 256
  i += 1
  a[i] = a[i] + 10 % 256
  i += 1
  a[i] = a[i] + 11 % 256
  i -= 5
  a[i] = a[i] - 1 % 256
i += 2
a[i] = a[i] + 2 % 256
print(end=chr(a[i]))
i += 2
a[i] = a[i] + 1 % 256
print(end=chr(a[i]))
a[i] = a[i] + 7 % 256
print(end=chr(a[i])*2)
i += 1
a[i] = a[i] + 1 % 256
print(end=chr(a[i]))
i -= 4
a[i] = a[i] + 2 % 256
print(end=chr(a[i]))
i += 2
a[i] = a[i] + 7 % 256
print(end=chr(a[i]))
i += 2
print(end=chr(a[i]))
a[i] = a[i] + 3 % 256
print(end=chr(a[i]))
i -= 1
print(end=chr(a[i]))
a[i] = a[i] - 8 % 256
print(end=chr(a[i]))
i -= 3
a[i] = a[i] + 1 % 256
print(chr(a[i]))
#

If I made a transpiler I would make it raise

TranspilerError: transpiler finished with non-zero indent level.
#

I would also build in a variant of a brainfuck interpreter that doesn't print or input anything but instead returns how many memory cells the script is likely to use; maximum i minus minimum i

#

It's great for making obfuscated python code if you can write in brainfuck

sly root
#

!e ```py
import ctypes as c
class memaddr:
init=lambda s,addr:s.setattr("addr",addr)
def write(s,d):
return 0if((lambda a:True if a is None else False)(({
int:c.c_int,
str:c.c_char_p,
bytes:c.c_char_p,
float:c.c_float,
}.get(type(d))).from_address(s.addr+type(d).basicsize).setattr("value",d)))else 1
get=lambda s,t:(t).from_address(s.addr)
repr=lambda s:"[memoryaddr: %s]"%(hex(s.addr),)
class mem_impl:
init=lambda s:s.setattr("cells",[])
def getitem(s,*cls):
with import("contextlib").suppress((SkipExc:=type("SkipExc",(Exception,),{"init":lambda s:None}))):raise[Exception("expected memaddr object, got %s"%(type(c),))if not isinstance(c,memaddr) else SkipExc for c in cls][0]
s.cells=cls[0]if type(cls[0])is tuple else cls
return s
get=lambda s,c:s.cells[c]
repr=lambda s:"[memorypack%s%s]"%(";"if len(s.cells)<1else": "," ".join([c.repr()for c in s.cells]),)
mem=mem_impl()

var = 20

a = memaddr(id(var))
b = mem[a]
print(a, b)
print(b.get(0))
b.get(0).write(10)

print(var)

night quarryBOT
#

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

001 | [memoryaddr: 0x7fa5e4ba0350] [memorypack: [memoryaddr: 0x7fa5e4ba0350]]
002 | [memoryaddr: 0x7fa5e4ba0350]
003 | 10
sly root
#

!e ```py
import ctypes as c
class memaddr:
init=lambda s,addr:s.setattr("addr",addr)
def write(s,d):
return 0if((lambda a:True if a is None else False)(({
int:c.c_int,
str:c.c_char_p,
bytes:c.c_char_p,
float:c.c_float,
}.get(type(d))).from_address(s.addr+type(d).basicsize).setattr("value",d)))else 1
get=lambda s,t:(t).from_address(s.addr)
repr=lambda s:"[memoryaddr: %s]"%(hex(s.addr),)
class mem_impl:
init=lambda s:s.setattr("cells",[])
def getitem(s,*cls):
with import("contextlib").suppress((SkipExc:=type("SkipExc",(Exception,),{"init":lambda s:None}))):raise[Exception("expected memaddr object, got %s"%(type(c),))if not isinstance(c,memaddr) else SkipExc for c in cls][0]
s.cells=cls[0]if type(cls[0])is tuple else cls
return s
get=lambda s,c:s.cells[c]
repr=lambda s:"[memorypack%s%s]"%(";"if len(s.cells)<1else": "," ".join([c.repr()for c in s.cells]),)
mem=mem_impl()

var = b"Test"

a = memaddr(id(var))
b = mem[a]
print(a, b)
print(b.get(0))
b.get(0).write(b"TEST")

print(var)

night quarryBOT
#

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

001 | [memoryaddr: 0x7f6d2ecf46f0] [memorypack: [memoryaddr: 0x7f6d2ecf46f0]]
002 | [memoryaddr: 0x7f6d2ecf46f0]
003 | b'TPI\xcf'
sly root
#

ohh

floral meteor
#

lmao

#

you broke it

sly root
#

!e ```py
import ctypes as c
class memaddr:
init=lambda s,addr:s.setattr("addr",addr)
def write(s,d):
return 0if((lambda a:True if a is None else False)(({
int:c.c_int,
str:c.c_char_p,
bytes:c.c_char_p,
float:c.c_float,
}.get(type(d))).from_address(s.addr+type(d).basicsize).setattr("value",d)))else 1
get=lambda s,t:(t).from_address(s.addr)
repr=lambda s:"[memoryaddr: %s]"%(hex(s.addr),)
class mem_impl:
init=lambda s:s.setattr("cells",[])
def getitem(s,*cls):
with import("contextlib").suppress((SkipExc:=type("SkipExc",(Exception,),{"init":lambda s:None}))):raise[Exception("expected memaddr object, got %s"%(type(c),))if not isinstance(c,memaddr) else SkipExc for c in cls][0]
s.cells=cls[0]if type(cls[0])is tuple else cls
return s
get=lambda s,c:s.cells[c]
repr=lambda s:"[memorypack%s%s]"%(";"if len(s.cells)<1else": "," ".join([c.repr()for c in s.cells]),)
mem=mem_impl()

var = b"hello world"

a = memaddr(id(var))
b = mem[a]
print(a, b)
print(b.get(0))
b.get(0).write(b"test")

print(var)

night quarryBOT
#

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

001 | [memoryaddr: 0x7fd071c006f0] [memorypack: [memoryaddr: 0x7fd071c006f0]]
002 | [memoryaddr: 0x7fd071c006f0]
003 | b'hP\t\xc0q\xd0\x7f\x00\x00ld'
sly root
#

wtf

floral meteor
#

you broke it harder!

sly root
#

it receives bytes

#

theres even no error

floral meteor
#

you managed to turn ascii into mojibake

sly root
#

xd

#

if it works with single char

#

lol

#

so it works normally when changing ints

#

and it doesn't works if target string is not bytes

#

!e ```py
import ctypes as c
class memaddr:
init=lambda s,addr:s.setattr("addr",addr)
def write(s,d):
return 0if((lambda a:True if a is None else False)(({
int:c.c_int,
str:c.c_char_p,
bytes:c.c_char_p,
float:c.c_float,
}.get(type(d))).from_address(s.addr+type(d).basicsize).setattr("value",d)))else 1
get=lambda s,t:(t).from_address(s.addr)
repr=lambda s:"[memoryaddr: %s]"%(hex(s.addr),)
class mem_impl:
init=lambda s:s.setattr("cells",[])
def getitem(s,*cls):
with import("contextlib").suppress((SkipExc:=type("SkipExc",(Exception,),{"init":lambda s:None}))):raise[Exception("expected memaddr object, got %s"%(type(c),))if not isinstance(c,memaddr) else SkipExc for c in cls][0]
s.cells=cls[0]if type(cls[0])is tuple else cls
return s
get=lambda s,c:s.cells[c]
repr=lambda s:"[memorypack%s%s]"%(";"if len(s.cells)<1else": "," ".join([c.repr()for c in s.cells]),)
mem=mem_impl()

var = b'test'

memaddr(id(var)).write(b'g\x00e\x01\x01Vk')

print(var)

night quarryBOT
#

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

b't\x00H\xa3'
sly root
#

it even got messed up with bytes lol

#

!e ```py
import ctypes as c
class memaddr:
init=lambda s,addr:s.setattr("addr",addr)
def write(s,d):
return 0if((lambda a:True if a is None else False)(({
int:c.c_int,
str:c.c_char_p,
bytes:c.c_char_p,
float:c.c_float,
}.get(type(d))).from_address(s.addr+type(d).basicsize).setattr("value",d)))else 1
get=lambda s,t:(t).from_address(s.addr)
repr=lambda s:"[memoryaddr: %s]"%(hex(s.addr),)
class mem_impl:
init=lambda s:s.setattr("cells",[])
def getitem(s,*cls):
with import("contextlib").suppress((SkipExc:=type("SkipExc",(Exception,),{"init":lambda s:None}))):raise[Exception("expected memaddr object, got %s"%(type(c),))if not isinstance(c,memaddr) else SkipExc for c in cls][0]
s.cells=cls[0]if type(cls[0])is tuple else cls
return s
get=lambda s,c:s.cells[c]
repr=lambda s:"[memorypack%s%s]"%(";"if len(s.cells)<1else": "," ".join([c.repr()for c in s.cells]),)
mem=mem_impl()

var = b'test'

memaddr(id(var)).write(b'g\x00e\x01\x01Vk')

print(memaddr(id(var)).get(c.c_char_p))

night quarryBOT
#

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

c_char_p(3)
sly root
#

how it got int

#

how

fleet bridge
#

lambda a:True if a is None else False -> lambda a: a is None

sly root
#

i'll add preprocessing step to my pseudo lang

#
str a = "hello world" if b```->```py
a:str="hello world" if b else(lambda:a.__del__()if a is not None)()if not b else None```
#

or will be better with normal ternary operator ?:

#

simple regex for it ((\ |\t?)+(.*)\ ?\?\ ?(.*)\ ?\:\ ?(.*))

#

group 2 is the captured indent

proper vault
#

what if you nest the ternaries?

#

I doubt regex is a viable tool here

sly root
#
namespace Test:
  class abcdef:
    constructor(self):
      pass;
    
    self::onCall(self):
      <--("hello world");

Test::abcdef test();
test() ? 1 : <--("test");
sly root
# sly root ``` namespace Test: class abcdef: constructor(self): pass; ...

converts to this:

import rich,_io
rich_print=getattr(rich,"print")
__dump__,__getch__=lambda*args:rich_print(*args),lambda*args,**kwargs:input(*args,**kwargs)
class Test:
 class abcdef:
  def __init__(self):
   pass
  def __call__(self):
   __dump__("hello world")
test:Test.abcdef=Test
test()if(1)else __dump__("test")```
#

but nested ternaries are a problem for this

#

because then regex must be very complicated, with repeating patterns and lookaheads/behinds to check if theres another ternary

#

I'll be working on it

sly root
#

so it replaced only the last ternary

dull token
#

wtf is esoteric python

lofty rapids
restive void
dull token
#

sheesh

#

may Jesus help yall

#

โค๏ธ

hollow tiger
night quarryBOT
#

archinstall/lib/general.py lines 354 to 357

self.pid, self.child_fd = pty.fork()
os.chdir(old_dir)

print(f"--Executing: {self.cmd}")```
restive void
#

Note the if not pid: below, which contains the code only to be executed by the child.

hollow tiger
restive void
hollow tiger
restive void
#

Ok. Nevertheless, you read from the child's file descriptors

hollow tiger
#

yea but print to another? Or is the print() code executed in the context of the child?

restive void
#

Both

hollow tiger
#

(and also to the childโ€™s standard input and output)

#

Oh.. bugger..

restive void
#

That's just how forking works

hollow tiger
#

Then what's the point of os.write() to the specific child file descriptor, if print outputs to both :S

restive void
#

Both child and parent continue at the same place

#

print outputs to both before the if not pid:

#

Like it's not that the one print call writes to both

#

print gets called twice, once in each process

hollow tiger
#

Oh f*** me xD haha, ok that's a huge miss on my part then.

#

If I move the print to after os.execve, will that still hold True? Or is it anything up to the point of os.close(child_fd)?

restive void
#

os.execve replaces the current process with the new process given by args

#

If you only want to print in the parent, move it to an else branch (so if pid is not falsy)

hollow tiger
#

Yea that worked, I think. I think I have code, that depends on this - that might output something.. some how.. between pty.fork() and os.execve(), meaning it's not "in the else"..

#

Btw huge thank you for explaining this in pretty good detail. 50% of it is still black magic that I guess I haven't wrapped my head around (thought I had..).
But at least this sheds clarity to what's going on and where to look for the bug ๐Ÿ™‚ So thank you!

restive void
#

Yeah, no problem. This is also very unesoteric and has nothing to do with Python, that's just how unix' fork() works

hollow tiger
#

I hear you loud and clear on that one, I guess I can only apologize and claim lack of knowledge thought this was python-dark-arts things messing with me.

restive void
#

Oh no, don't take this as a "how dare you post this in #esoteric-python", just for "where to look next if still unclear"

inner blade
#

I'm having a discussion with a member here who thinks that the behavior of ```py
all_equal([])

should possibly not resolve to ```py
True

as a philosophical point. I tried explaining that the function is not trying to assert that there are some elements equal to each other, but instead is validating that every element in the list meets some criteria. Since there are no elements in the list, they all do meet the criteria. I cited this:
https://en.wikipedia.org/wiki/Vacuous_truth

Then I ran out of steam, but the user is still not convinced and is seeking more explanations or other opinions. Can anyone else help with this?

cheers

@balmy night

In mathematics and logic, a vacuous truth is a conditional or universal statement (a universal statement that can be converted to a conditional statement) that is true because the antecedent cannot be satisfied. For example, the statement "all cell phones in the room are turned off" will be true when no cell phones are in the room. In this case,...

restive void
#

I mean it really depends on the definition of the function. But I'd expect it to return True on empty input.

inner blade
#

That is true, it does depend on the definition of the function. Let's maybe focus on the statement For example, the statement "all cell phones in the room are turned off" will be true when no cell phones are in the room.
Donut believes this could be resolved to False instead of True. Thoughts?

restive void
#

So this is where pragmatics comes into play

#

Evaluated purely in a logical/semantic fashion you are of course correct, but pragmatics (in this case probably the maxim of relevance) implies that there are cell phones in the room.

inner blade
#

True, there is an implication that cell phones are in the room in natural language

#

but in the case where that implication doesn't hold, what do we do?

balmy night
#

Well I didn't say it has to be False but there's an argument to be made:
because if no elements are equal to each other, then not all elements are equal to each other!

inner blade
#

see, that's not correct

#

it is true that all elements of an empty set are equal to each other

restive void
#

Logically, you would be incorrect there, @nova sun โˆ€xโˆ€y x=y holds.

balmy night
#

huh?

#

what are these symbols

restive void
#

"For all x, for all y, x is equal to y", would be the translation of this statement into predicate logic (with equality)

#

And that statements evaluates to truth when the universe is empty

balmy night
restive void
#

No, because I can find two elements (1 and 2) that are not equal

balmy night
#

because if no elements are equal to each other, then not all elements are equal to each other
this statement hold true

balmy night
#

how come?

restive void
#

Show me that it does

balmy night
#

if 1 is not equal to 2
and
2 is not equal to 3

then all of the elements are not the same, because there is at least pair 1 which is not equal

restive void
#

Yes, obviously. When the universe contains more than one element, then it depends on the nature of those elements whether the statement is true

#

I don't argue the [1, 2, 3] case

#

But in general it is not true that if there are no elements equal to eachother, not all elements are

balmy night
#

not all elements are
are what? are blue? yeah I agree

restive void
#

...equal to eachother

#

(do we maybe want to take this to an off-topic channel? not really esoteric python)

balmy night
#

give me an example and do a walkthrough with your logic and that example

restive void
#

Well, the two examples are an empty universe, and one containing only one element.

#

Let's do the latter for a change:

#

if the iterable is [1], then would you say that all elements are equal?

balmy night
#

yes of course

balmy night
restive void
#

Alright, then only the empty iterable case remains. For all elements x in the iterable, for all elements y in the iterable, they are identical.

#

!e

def all_equal(iterable):
    for x in iterable:
        for y in iterable:
            if x != y:
                return False
    return True

print(all_equal([]))
night quarryBOT
#

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

True
balmy night
#

yes, I understand that, like the implementation on all([])

#

I don't argue that you're wrong, I argue that there're two truths...

inner blade
#

arguing that there are two possible interpretations is arguing that we're wrong; the situation is that there are not two interpretations

restive void
#

There are (at least) two ways of translating the human language sentence "all elements in the iterable are equal" into logics, yes

balmy night
#

because as I told usidore the blue, English is not my native tongue. you guys have a "home court advantage "
can anyone try to convince us that my point of view can be right too?

#

maybe you can @restive void

#

can you do that?

inner blade
#

you could say that the natural language implication is that there are elements in the set, but this is cultural, language specific, and not part of formal logic

restive void
#

it's the name all_equal which (until defined one way or another) undergoes human interpretation, including pragmatics

#

Personally, I would certainly interpret it in the way you do, @inner blade. But I also am not a native speaker of English (but of a very related language)

inner blade
#

I think this wiki page really covers the nuance of this pretty well, and explains how it could be misleading in natural language

https://en.wikipedia.org/wiki/Vacuous_truth

In mathematics and logic, a vacuous truth is a conditional or universal statement (a universal statement that can be converted to a conditional statement) that is true because the antecedent cannot be satisfied. For example, the statement "all cell phones in the room are turned off" will be true when no cell phones are in the room. In this case,...

#

I don't know

restive void
#

But that is only once you accepted the logical interpretation I gave above in symbolic language

balmy night
#

who decides what's formal logic, If let's say someone said that vacuous truth should be false
meaning ""all cell phones in the room are turned on and turned off", then it's false because there are no cell phones to be turned off"
would you still argue with me?

restive void
#

You could interpret it also as: โˆ€xโˆ€yโˆƒz x=z โˆง x=y

balmy night
#

chief I barely understand English...

restive void
balmy night
inner blade
balmy night
#

again, I am explaining/expressing myself poorly...

restive void
#

Vacuous truths are true, there's no other valid opinion about that. The question is whether a given statement leads to a vacuous truth.

#

(But I think I've said everything I have to say about the topic at least once, I'm gonna go; y'all have fun)

inner blade
balmy night
#

""all cell phones in the room are turned on when there are no cell phones in the room" is a false statement because there are no cellphones that are turned on

balmy night
inner blade
#

I recommend reading the wiki page, and the top answer on stackexchange, and giving them some time

#

I'm sorry I couldn't do more for you

#

I also really don't have anything else to offer

balmy night
inner blade
#

no

balmy night
#

why?

inner blade
#

because it isn't false

balmy night
#

Who says if it's not false, it's true?
one could say if something is not true, it's false
then your "vacuous true" are false

#

don't reply to me with the link

#

let this thought float in your head for a sec

inner blade
#

it doesn't matter what people say; it's not an opinion; vacuous truths are true - we don't define them to be true, it's an inherent characteristic

#

Who says if it's not false, it's true?

This actually may be pushing up against an axiom of propositional logic; not false is true, that might axiomatic

#
>>> not False
True
balmy night
#

then you just get stuck with that "solid rule" who says?

inner blade
balmy night
inner blade
#

no, ```py
all([])

is not axiomatic, but it relies on the axioms as do all statements. If you have a philosophical issue with ```py
>>> not False
True``` you should definitely focus on that
proper vault
#

it is simply more useful to have the notion of for every element, P hold for 0 elements. It makes inductive proofs reasonably possible.

#

you could of course define your own system of predicates where forall entails exists, but GL actually using it

balmy night
proper vault
#

well, no. If you are not a girl, then you are not a girl. It makes no statement on anything else

balmy night
#

exactly
then
not False is not always True

proper vault
#

not False is True by the definition of a boolean

#

its just that boolean is not always the correct way to describe a fact

inner blade
balmy night
inner blade
#

you don't have to like the definition but it will break computer science because compsci is built on that axiom

#

it'll break propositional logic as well

proper vault
#

eh, you could just rewire the axioms, it just makes things more complicated

inner blade
#

you could create a new logic and write axioms, yes

#

you could derive all kinds of statements or whatever

proper vault
#

a complete logic system is complete regardless of what insane building blocks you use

inner blade
#

right

balmy night
#

you are getting side tracked, you could create a world like meta and program everybody to follow you
what's the point?

inner blade
proper vault
#

all asks if every element is true, in other words, it asks whether there isn't any False, or whether it isn't true that False is in the list

balmy night
#

I gave the example you gave, I could also give the boy / girl example

proper vault
#

and clearly, whether False is in a list can't change by adding more True

balmy night
#

that's why I said:

two truths, society decides one, don't mean the other one is wrong or false

earnest wing
#

thinking of all in terms of folding over an iterable with and may help (this intuitively leads to True as a default value)

proper vault
#

so all([]) and all([True]) should have the same result

earnest wing
#

similarly, any is an or-fold, yielding a default value of False

inner blade
#

yeah any is means that at least one element in the set meets some predicate

#
all([]) and any([])
``` should be False
earnest wing
#

they're just friendly names for forall & exists

balmy night
#

any([]) is false wtf,

proper vault
#

indeed, no element of [] is True

inner blade
earnest wing
balmy night
#

In mathematics and logic, a vacuous truth is a conditional or universal statement (a universal statement that can be converted to a conditional statement) that is true because the antecedent cannot be satisfied. For example, the statement "all cell phones in the room are turned off" will be true when no cell phones are in the room. In this case,...

proper vault
#

in other words, every element of [] is False

inner blade
proper vault
#

the trick is that the negation of all(x) is not any(not y for y in x)

balmy night
#

"there are some cellphones, therefore some of them are turned off"

proper vault
#

ah, no. You now have a some

#

which implies there is at least one

balmy night
#

no

proper vault
#

all cellphones are off

#

but some cellphone isn't off

earnest wing
#

you have changed the definition from exists to subset

proper vault
#

since some cellphone doesn't exist

earnest wing
#

that is a different statement

earnest wing
balmy night
#

wait, revert that

balmy night
earnest wing
#

the point is, natural language is not rigorous

proper vault
earnest wing
#

and more consistent

proper vault
#

if you define things differently, predicates get more complicated

earnest wing
#

basically it avoids having to add special cases to every empty set

proper vault
#

this is a very natural way to form these predicates

balmy night
#

ok then I made my point!
you just decided that, I could decided the opposite
and you can't say my decision is false or wrong

earnest wing
#

tl;dr is it the (mathematically) natural definition

#

and thus maths & much of programming follows the convention

proper vault
#

of course, you can do whatever definitions you want

balmy night
#

conventions are not facts

earnest wing
#

so what

inner blade
primal idol
#

I started reading this and it reminded of how people explain why 0 factorial equals one x)

proper vault
#

well, definitions aren't truths

earnest wing
#

definitions are true by definition :>

proper vault
#

they are simply helpers to express things

balmy night
#

which still proves my point

proper vault
#

if your point was that it is valid to invent a forall which entails exists, sure

earnest wing
#

i'm not sure what this argument stems from since I dropped in late, but I hope I have been able to explain some of the mathematical reasoning for the convention

#

if it's a personal gripe then i couldn't care less though

proper vault
#

let me pose a fun little problem: under your formalism, what is the negation of every cellphone in the room is off?

balmy night
#

I didn't understand that.
but my point is that all([]) doesn't have to be True it can be False,
we decided that it would be True
but saying that the result is False is not false or wrong (maybe by convention, but we decided a convention)

proper vault
#

write a statement that is the opposite of every cellphone in the room is off

balmy night
#

every cellphone in the room is not off

proper vault
#

under the conventional definitions, it is there is a cellphone in the room that is on

#

well, that's wrong

#

because what if we have one cellphone that is on, and another that is off

#

then not every cellphone is off, but your statement also isn't true

#

so it isn't the opposite

balmy night
primal idol
#

No, but in this case it is just logic

proper vault
#

lets not worry about that. Your negation was wrong in an objective way

balmy night
inner blade
#

@balmy night i recommend that you focus on the example provided, they're trying to help give you an insight

proper vault
#

in the same way I can define the absolute value in terms of distance from the value 1+4j, you can define your predicates differently. Doesn't make it actually useful or meaningful

balmy night
#

who said that true is true?
we, we could have said that true is false
it's not an axiom...

proper vault
#

seriously, try to figure it out the negation

#

it's actually kind of interesting

balmy night
#

ok yours is correct

proper vault
#

under your definitions, it isn't

balmy night
#

why not?

earnest wing
#

are you perhaps interpreting all(X for X in Y if Z) similarly to "is the proportion of X in Y that satisfy Z 100%"?

proper vault
#

well, for a room with no cellphones, you state that not all are off. My negation is that there is at least one which is on, which is also not true

#

therefore, not a negation

balmy night
#

please examples are not great,
focus on my statement:

two truths, society decides one, don't mean the other one is wrong or false

earnest wing
#

this isn't a society thing tbh

proper vault
#

truth is objective

earnest wing
#

it's a "overwhelmingly common mathematical convention" thing

proper vault
#

it just lies on how we describe it

#

you can write the same statements under any weird mix of definitions

balmy night
earnest wing
#

?

#

I don't understand

balmy night
#

didn't we make mistakes in the past?

earnest wing
#

I am very confused

proper vault
#

you are kind of missing the point

#

the statement under your definitions would be written in mathematical language like so there is at least one phone, and all the phones are off

balmy night
#

again english is not my native tongue
maybe can someone brave try to "move" to "my side"?

proper vault
#

it's the same statement as all phones are off under your understanding of all

earnest wing
#

like, sure you can e.g. divide by zero if you just define it to work
but, like, you lose a lot of interesting properties of real numbers that way, and it turns out the maths becomes more complicated, and it's not as useful of a tool as what you had originally

proper vault
#

just written differently because well, definitions differ

earnest wing
#

actually, I should check

proper vault
#

the truth of a statement is objective, the way to write that statement depends on definitions

earnest wing
#

is formal logic + "empty forall is false" even a consistent (non-contradictory) system of logic lol

#

it might not

balmy night
earnest wing
#

@inner blade are you versed in logic mayhaps

#

any pointers?

proper vault
#

it trivially is tbh

#

you can just add a disjunction to every forall allowing for an empty set by negating exists: 1

#

and you are back to how we were before

earnest wing
#

so such a system is structurally equivalent, just phrased differently

proper vault
#

the meaning is objective, the notation is not

#

so there aren't really 2 truths

#

just like the same sequence of letters can mean different things depending on language

inner blade
balmy night
#

is it objective?
Let's eat grandma?

#

what did I mean?

earnest wing
#

i meant like
โˆ€
I see

proper vault
#

again, notation is ambiguous

inner blade
#

@earnest wing under the defined meaning + axioms, empty has to be True or the logic is inconsistent

proper vault
#

there is a reason math doesn't use english

balmy night
#

I don't get what notation is here, did I make any?

proper vault
#

yes, english is notation

#

not a very good one from a formal perspective, since, as you demonstrated, it is ambiguous

inner blade
# earnest wing ~~i meant like โˆ€~~ I see

yeah I mean you have this symbol; this symbol has a meaning, and under that meaning if you also define the application of that symbol to an empty set with some predicate as False, then you won't have a consistent logic anymore

proper vault
#

also kind of complicated to manipulate, in contrast to sth like predicate logic

earnest wing
#

right yeah that was my question

#

thanks

balmy night
earnest wing
#

I also found interesting resources

proper vault
#

indeed

balmy night
#

then you can't say there's no two truths!

proper vault
#

there are no two truths

#

just two ways to write one truth

#

facts don't change, our ways to describe them do

#

and when we say predicate logic, we mean the conventional definitions, including forall being true for empty sets.

#

just because otherwise communication breaks down

balmy night
#

python, all, any, are all notation that we interpreted one way, but we could have easily interpret them the other

proper vault
#

sure, but then those functions mean different things entirely, and thus are new notation which describe different underlying logic

#

same word, but you give it a new meaning

primal idol
balmy night
#

everything we: think, hear, see, write, and so on
are all interpretations! you can't say that only one way is correct,
you have to define what is correct which is again also a notation
therefore everything is a notation and nothing is "all ways true"

proper vault
#

under some notation, you can get objective truths

#

without definitions, notation is useless

balmy night
#

right

#

going back to the beginning:
does all([]) must always, 100% be True?

proper vault
#

no, you can do

all = lambda _: 'carrot cake'
#

and now it's 'carrot cake'

balmy night
inner blade
balmy night
#

no

proper vault
#

but well, in the way all is defined, all([]) is True

#

if you change the definition, it doesn't have be True

balmy night
#

I define a list will all true values to have:

  1. elements
  2. all elements must be true
inner blade
#

you can always change the definition; are you asking if we could change the word all to marbles? We could do that.

proper vault
#

then you changed the definition, and now have a new idea, distinct from what all means in python right now

balmy night
#

Did I ask you that?

#

Did I ask you anything at all?

inner blade
#

we could replace the word all in the dictionary with smoarea, but all has a meaning and if we focus on the meaning rather than the term, then we're still faced with the same problem

balmy night
#

And I quote "two truths, society decides one, don't mean the other one is wrong or false"

inner blade
#

vacuous truth is still truth no matter what words we use

balmy night
#

it's not

proper vault
#

you can of course invent your own terms, even reusing existing terms, in which vacuous truths are explicitly forbidden by attaching an implicit there is at least one

balmy night
#

depends on how you define true?

primal idol
#

I mean, I would agree with them that you could say that if you start from the point that all propositions are false until proven otherwise, you could say that "all elements must evaluate to true" should be false

#

if there are no elements

inner blade
#

ok well, I gave it my best shot, I don't have anything else to offer, I'm sorry

earnest wing
#

@inner blade okay right yeah \forall x \in X . P(x) desugars to \forall x . x \in X -> P(x) and the subset statement is always false for empty sets, therefore the whole expression is true by explosion
and you can't make that false without changing a lot more
that's very clear now

balmy night
#

You guys can be funny, but my point stands...

earnest wing
#

good luck

proper vault
#

the true isn't really a "default"

primal idol
#

Convinced

#

You are right xD

severe canyon
proper vault
#

I meant one as in at least one, not exactly one

#

but ye, should probably specify

severe canyon
#

just curious ๐Ÿ˜Š

earnest wing
#

well, one element is false is also another natural language gotcha

balmy night
#

if all elements are true, and the opposite is one element is false
it doesn't says s.. about nothing does it?

proper vault
#

this is why we invented predicate logic

#

well, one element is false is clearly not true for an empty list

#

there is no one element that is false

primal idol
#

Lets find a way to negate that

severe canyon
proper vault
#

every single element of an empty list is true

inner blade
balmy night
#

both conditions are not met, then why is it true?

earnest wing
balmy night
severe canyon
#

^

balmy night
#

this is the moment we all lived for

severe canyon
#

is {ร˜} truthy? if so why? no elements to compare to
it should be in a state of limbo, no?

proper vault
#

do you mean a singleton set of an empty set?

balmy night
proper vault
#

that is a non-empty set, so it is not really weird in this way

balmy night
proper vault
#

well, if both conditions are not met, then clearly we didn't find a negation

severe canyon
inner blade
#

I don't understand your question, could you write it again in a different way? @balmy night

proper vault
#

isn't the empty set generally {} or ร˜? Not both

primal idol
#

ร˜ yeah this is the empty set iirc

severe canyon
proper vault
#

regardless, the empty set is falsey according to python, but any statement about its elements will hold

severe canyon
#

still. my point stands

earnest wing
# balmy night both conditions are not met, then why is it true?

because if X is empty, then "element x is inside X, therefore Condition(x) is true" always has "false" on the left side
and the systems of logic we use define "false, therefore [literally anything]" to always be true
it's called the principle of explosion

balmy night
proper vault
#

yeah, the implication example is a good one

inner blade
balmy night
#

this is an example, don't expliot it

#

if X is not Y
and X is not Z

what is X?

inner blade
#

assuming i can only have whole integer number of apples

proper vault
#

in order for all(x) to be True, this must hold: if an element is in x, it must be True.

earnest wing
#

every english example is just another piece of linguistic ambiguity about to confuse this conversation
sadcat

severe canyon
#

is how i think about it

inner blade
earnest wing
#

well truthiness can be defined in many ways, while forall and exists have rigid definitions

balmy night
#

If list, ls:

  1. doesn't have at least one element is false (at least one element is false -> False)
  2. and not all elements are true (all elements are true -> False)

is ls True or False?

severe canyon
#

"complete" or smthing

balmy night
#

I don't know about you, but I couldn't tell you...

severe canyon
#

same

earnest wing
inner blade
balmy night
#

exactly, then why all([]) is True?

earnest wing
#

it's not, all([]) is

balmy night
#

all I meant

primal idol
#

oh you edited

#

nvm

earnest wing
#

i think we've explained multiple times tbh

#

the maths is abundantly clear

balmy night
earnest wing
#

seems like an unfair comparison to be fair

balmy night
#

the thing that you guys don't get.
it can be the exact same thing.

think about that

earnest wing
#

okay buddy

#

anyways

inner blade
#

@severe canyon we can say things like:

P is True, therefore P is not False.
P and (if P then Q), therefore Q

earnest wing
#

what's the easiest way to mutate locals programmatically?

severe canyon
earnest wing
#

(without assignment ofc, assuming string keys etc)

balmy night
#

eval

inner blade
severe canyon
#

sure

earnest wing
inner blade
#

or I don't understand, how am I supposed to evaluate whether A set is truthy if all its elements meet a requirement for truthyness is True or not based on a set being empty?

severe canyon
#

if no elements exist, how can they meet a requirement

earnest wing
#

that's been explained about a dozen times in chat over the past hour

severe canyon
#

it mightve been, i kinda just jumped on this in the middle xD

earnest wing
#

haha

severe canyon
#

please link to the message, and ill show myself out :)

inner blade
# severe canyon please link to the message, and ill show myself out :)

This wiki page is probably the best explanation https://en.wikipedia.org/wiki/Vacuous_truth

In mathematics and logic, a vacuous truth is a conditional or universal statement (a universal statement that can be converted to a conditional statement) that is true because the antecedent cannot be satisfied. For example, the statement "all cell phones in the room are turned off" will be true when no cell phones are in the room. In this case,...

severe canyon
#

ill take a look

inner blade
#

it goes into some of the nuance and explains why it can be unintuitive

primal idol
balmy night
# earnest wing okay buddy

what does all check?
if all elements are True right?
in the case that list = []
are there any False elements? No
are all elements True? Well, there are none.

so if there are no False value, "why all elements" is True?
(this is the question all "answers")

#

it can be either False or True; I couldn't tell you

primal idol
#

so you are saying it should be false right? Or are you saying there is no answer?

inner blade
#

if all elements are True right?

no, that would be circular logic; all cannot be defined to check if all @balmy night

earnest wing
#

i think the wiki page is the clearest answer for that

#

so like, check out the wikipedia link

balmy night
#

you mean it's kinda recursion?

inner blade
#

that's not its definition; we can't define the behavior of all using all

severe canyon
inner blade
#

otherwise we have to evaluate all in the definition, we have to agree what it actually means first

#

we can't just agree that all means all as a starting point; it has to actually mean something

primal idol
#

and if you agree that is should equal False, you lead to a contradiction

#

therefor it should be true

balmy night
#

Ok, then it's defined that way, but let's say it doesn't we are making a new language....

primal idol
#

No the thing if it doesnt have a definition

balmy night
#

could you tell me is it True or False?

earnest wing
#

then your new language has boolean logic that creates contradictions

#

unless it's True of course

earnest wing
#

then there's no contradiction

primal idol
#

You have said "all checks if all"

#

you cannot define something like that, it is like asking what a word means and saying it means itself

balmy night
#

exactly, this is my point...
you can't tell me; unless it's defined / we define it as something....

primal idol
#

YES

#

if we define it

#

it is either ture

#

or false

#

however

inner blade
primal idol
#

we cannot define it as false

#

because it leads to a contradiciton

#

therefor it is not that we want to define it as true

#

we just kinda have to

balmy night
#

this is my point

#

this is my point.

primal idol
#

Donut

#

should we have a definition for all

severe canyon
#

my axiom is everything is false
we live in a simulation :O

primal idol
#

?

#

we have to agree what it should be equal to

#

otherwise what is the point of having all to begin with

#

It must be defined

#

There is only one way to define it, that wont lead to a contradiction

balmy night
#

when I say "all" you view it one way, I can view it the other.
and to a baby who isn't biased in any way, can see both "all"s as legitimate...

earnest wing
#

Consider the suggestion that all([]) and any([]) shoud both be false
The famous DeMorgon's law states that all(y) == not any(not x for x in y).
Let y be empty. Then:
all([]) == not any(not x for x in [])
all([]) == not any([])
False == not False
False == True

balmy night
#

intuition is subjective...

primal idol
#

"all"s as legitimate... no, because only one of them don't lead to a contradiction where unicorns exist

earnest wing
#

logic is not subjective :>

#

the "intuitive sense" bit was just trying to explain why the law is true at a glance

balmy night
inner blade
#

or maybe just describe it more

#

well there you go

balmy night
# primal idol Bruh

you are giving examples, I am returning you a "favor".
it sounds stupid to you. but it can happen, use a bit of imagination
imagination is a bad choice of words, but you get me

earnest wing
#

the return value of locals() doesn't actually control the locals

#

it's just a copy

#

i remember there was a library or something that did that

balmy night
#

well it was

primal idol
#

interesting

#

I thought it was just like globals but for local scopes

earnest wing
#

i think it's because of how cpython implements them

primal idol
#

Nah it doesnt work on a function

#

It does work on the global scope though

#

Humm, can't you use the inspect module to get the stack of the function?

#

I dont know if it is mutable though

#

Hey maybe this?

#

Nvm the answer is right under it, you can only modify it, not add new variables

floral meteor
#

As it seems to require three elements to exist

#

Swinging around these logic statements when the target audience isn't guaranteed to be able to interpret them is one thing, making a seemingly irrelevant proposition like that is another.
Also did this need to happen in #esoteric-python?

short crag
floral meteor
#

so for all x and y, x is equal to y and a third element z

floral meteor
#

!e ```py
globals().clear()
builtins={}

no brackets after this

build_class=lambda*a:None
name='main'
sub = ....class.base.subclasses
@sub.class.call
@lambda _:sub
class a:0

@a.getitem
@lambda _:104
class a:0

@a.load_module
@lambda _:'sys'
class a:0

@a.stdout.write
@lambda _:"Hello World!\n"
class a:0

night quarryBOT
#

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

Hello World!
restive void
floral meteor
#

alright, but in that case, for all x and for all y something exists, but if there's no x and there's no y, then nothing needs to exist at the something exists expression because it parses 0 times

#

therefore it returns true for an empty set

#

because there's nothing in the set which makes the proposition false

#

!e

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

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

001 | 1
002 | True
floral meteor
#

you can't argue against mathematics and win.

floral meteor
#

everything to power of zero is 1

#

there's no difference between 1**0 and 0**0 because the first term is eliminated by the zeroness of the second term

#

hence leaving the multiplicative identity

#

1 * x = x
0 + x = x

x ** 0 = 1
x * 0 = 0
x + 0 = x

I don't see what is so confusing about 0**0 = 1

#

it's not like 0**x = 0, that's just a pattern, it doesn't hold true for x = 0

#

same way a/a = 1 doesn't hold true for a = 0

#

x ** 0 on the other hand is always 1

grizzled zenith
#

it is not, when the limit tends to zero then it is inderterminate

#

absolute 0โฐ is 1

floral meteor
#

obviously 0/0 is taboo

grizzled zenith
#

?

#

taboo?

#

you cant divide by 0

floral meteor
#

I once had a username Negative Zero Divided By Zero

#

just to see how many people I could get to hate me on that basis alone, then befriend them because obviously they're the smarter ones

#

you do not divide by zero

grizzled zenith
#

yes

#

thats what i was saying

floral meteor
#

Thou shalt divideth not by zero

grizzled zenith
#

yessss

floral meteor
#

hey that gave me an idea!

#

I'm gonna make the line 0/0 print hello world

grizzled zenith
#

?

#

example?

#

the other people need to prove it that so

#

like i say 2+2=4 someone says it is 5 then how is it inderterminate

restive void
grizzled zenith
#

2ยฒ= 1ร—2ร—2
0ยน = 1 ร— 0
0โฐ = 1

#

here how our teacher showed it

grizzled zenith
#

theres always one there

#

and the indice denotes how many times the number is going to be there

#

for 2ยฒ there going to be 2 two

floral meteor
#

there's zero terms of the first number, therefore it has no importance in the evaluation of the result, as there only leaves behind the multiplicative identity

grizzled zenith
#

yes

floral meteor
#

so 0**-0 cannot work?

#

because it's 0/0?

grizzled zenith
grizzled zenith
floral meteor
#

wait if 0**-0 is equivalent to 0 /0 0 times, and 0**-0 can be simplified to 0**0, then that means 0\0 = 0*0 = 0

#

wait now my brain is fried

grizzled zenith
#

oh yea

#

-0 is 0

#

how?

#

absolute 0โฐ is not indeterminate

#

lim x->0 x^x is indeterminate

#

-0 is not a thing

floral meteor
#

0 divided by zero, zero times

#

that is a beautiful concept: zero doesn't get divided by zero

#

0**-0 is the very concept of zero not being divided by itself

grizzled zenith
floral meteor
#

also when did esoteric-python turn into esoteric-mathematics?

grizzled zenith
#

and ex means exact

floral meteor
#

there is an implicit exp==1*exp for each exp that is reduce(multiply, iterable)

#

therefore if 0 is multiplied by zero zero times, that is
reduce(multiply, [0]*0)
then we have 1*(nothing)
which is just 1

#

yes

#

because 1 is the multiplicative identity

#

just like 0 is the additive identity, and our intuition is familiar with the linear scale, which is why we naturally feel an expression mutating 0 zero times should evaluate to 0

grizzled zenith
#

0**0 = 1
0**-0 => 1/0**0 = 1/1

floral meteor
#

but we're working with a different scale here, one where 1 is where everything revolves around

floral meteor
#

you see in a system where 0**0, everything makes sense, except for 0/0 and related phenomena
however undefining 0**0 would just make another 0/0 issue for no reason other than your small brains find 0**0=1 unintuitive

#

0**a is 0 unless a is 0

#

!e ```py
print(import('math').log(0))

night quarryBOT
#

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

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | ValueError: math domain error
floral meteor
#

dead

#

e**x = 0 what is x?

#
  • infinity
grizzled zenith
#

0 cant be a base

floral meteor
#

log(1)/-infinity tends to -0

grizzled zenith
#

its not in the domain

floral meteor
#

therefore log(1)/log(0) tends to 0

#

it can only be evaluated with limits

#

but limits tend it to 0 from the negative side

#

as lim h->0 log(h) -> -inf therefore lim h->0 log(1)/log(h) -> 0

#

someone please write something on paper typing up mathematics is unpleasant

floral meteor
#

It has been decide that in the empty set element equality problem, "all elements are equally nonexistent"

#

no logic whatsoever, completely intuitive argument for all_equal([]) = True

earnest wing
floral meteor
#

oops

#

!e ```py
from ctypes import py_object
p = py_object.from_address(id(0)+8)
class Int(p.value):
def truediv(self, other):
return super().truediv(other)if other else print("Hello World!")
p.value = Int

0/0

night quarryBOT
#

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

Hello World!
earnest wing
#

The only correct answer

floral meteor
#

There we go I have proved that 0/0 = Hello World!

#

that should scare the mathematicians out of this channel

floral meteor
#

I broke maths, and I can break it harder

#

!e ```py
from ctypes import*
cursed = py_object.from_address(id(0)+8)
class BreakPython(cursed.value):
def truediv(self, victim):
return super().truediv(victim)if victim else string_at(0)
cursed.value = BreakPython

0/0

night quarryBOT
#

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

[No output]
floral meteor
#

that's what dividing by zero should do in python

#

it should make the computer either blue screen or kernel panic depending on OS

severe canyon
#

I like your style

floral meteor
#

ty, me too

severe canyon
#

:)

finite blaze
#

I am waiting for someone to implement i++, i--

floral meteor
#

!e hmm

_ = [__import__('ctypes')]
_=[_[0].py_object.from_address(id(0)+8),*_]
class __(_[0].value):
  def __truediv__(_0,_1):
    return super().__truediv__(_1)if _1 else _[1].string_at(0)
_[0].value = __

0/0
night quarryBOT
#

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

[No output]
finite blaze
#

class __(_[0].value

#

what

floral meteor
#

!e ```py
_ = [import('ctypes')]
=[[0].py_object.from_address(id(0)+8),*]
class __(
[0].value):
def truediv(0,):
return super().truediv(_)if _ else print("what")
_[0].value = __

0/0

night quarryBOT
#

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

what
floral meteor
#

XD

floral meteor
finite blaze
#

why not?

floral meteor
#

!e i++

night quarryBOT
#

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

001 |   File "<string>", line 1
002 |     i++
003 |        ^
004 | SyntaxError: invalid syntax
floral meteor
#

that

finite blaze
#

yeah i know that

fleet bridge
#

!e ++i

night quarryBOT
#

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

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | NameError: name 'i' is not defined. Did you mean: 'id'?
floral meteor
#

you see that's possible because no syntaxerror

finite blaze
#

thats why i said that someone should make a lib for it

floral meteor
#

++i has been done before iirc

finite blaze
#

I wonder how you even approach making something like this

#

just regex?

floral meteor
#

every second pos of a integer value stored in globals will increment it.
negative still negatives, but every second negative decrements.
storing the variable resets the counter

#

therefore -(-i) probably would result in --i

#

but that's just python parser