#esoteric-python
1 messages · Page 60 of 1
I can disable MRs again if you like, i enabled them just so you could see when someone opens an MR
Shawn McLaughlin pushed to branch master of python-discord/esoteric-python-challenges (Compare changes)
There is two links, so there are two embeds
Anyways, any input on the challenge draft up there lads?
Gitlab has no way to know discord is accessing it twice for one message
the challenge looks great
naw, it's a webhook
but wait @vague gust is that webhook something gitlab just provides?
or did we hack it together?
I remember you did write a hook for.. what was that.. travis?
with like flask and shit
if we controlled it we could wrap the urls in chevrons
it's the default slack notifications
Shawn McLaughlin pushed to branch master of python-discord/esoteric-python-challenges (Compare changes)
ccae2caf: add challenge 02!
- Shawn McLaughlin
right
we don't control that one
You controll the bot though?
Shawn McLaughlin pushed to branch master of python-discord/esoteric-python-challenges (Compare changes)
god damnit
but it's just a webhook, which basically you just send web requests to
a URL that feeds messages straight into the chat here as if from a bot
why not hack together a little proxy between the two
So you could find replace the links to the non embed version
yep
wouldn't be a problem
but we'd need to send the webhook somewhere else
fuck with it
and then send it on
we could probably build an API endpoint for that on our site
hey, I don't love it either
it's just a bit hacky to solve it like that
would be great if gitlab had a discord webhook that just did it
ATTENTION ATTENTION: CHALLENGE #2 IS OFFICIALLY UP!
GET CODING, PYTHONISTAS <3
curtsies thank you, dad
Joseph Banks (JoeBanks13) opened !2 *Add joseph's solution* in python-discord/esoteric-python-challenges: Add joseph's solution
wait what you already friggin wrote a solution to the new challenge!?
:)
well
it doesn't take in a number
it's also another incredibly moronic solution like my last entry
oh my god
nice
its the generator
its horrid
lmfao
Joseph, I can say with confidence that looking at your solution made self-immolation sound appealing
generator literal
lmao
hey now
generators are not literals
there are a couple literals in there though
I guess comprehensions aren't literals
hold on
it seems to be a mix
okay i pushed the fixes
>>> dis.dis("(x for x in string.printable)")
1 0 LOAD_CONST 0 (<code object <genexpr> at 0x7fadcbdae6f0, file "<dis>", line 1>)
2 LOAD_CONST 1 ('<genexpr>')
4 MAKE_FUNCTION 0
6 LOAD_NAME 0 (string)
8 LOAD_ATTR 1 (printable)
10 GET_ITER
12 CALL_FUNCTION 1
14 RETURN_VALUE
see, there are 2 constants loaded
but i'm not sure
"".join([random.choose(string.printable) for i in range(0,10)]) or something
0 is a literal
:^)
damn
it's harder than one things
generators seem like a relatively practical way for list indexing
thank you clay :^)
str.join on a range of the input number
I'll write a solution tomorrow, it's too late rn
p sure thats specifically mentioned
shawn review when
If shawn writes a serious review @vague gust should rap it
good idea
The review should be generated by your code
@frosty wyvern so what do you think
he just wants you to review his code
yeah
i want a review
and potentially a merge
i'll also rap your review if it's serious
Joseph do you wanna record a collab mixtape
#define cCC 9
#define cCCC 4
#define cCcCc 3
#define CcCcC 7
#define cCCc 5
#define CcccC 6
#define c 1
#define cc 2
#define ccc 8
#define cccc 0
#define C(CCc, Cc, cC) CCc ## Cc ## cC
#define CC(CCc, Cc, cC) C(CCc,Cc,cC)
#define CcC(CCc, Cc, cC) CC(CCc,Cc,cC)
#define CccC(cC, cCc) cC ## cCc
#define cCccC(cC, cCc) CccC(cC, cCc)
#define ccCccC(cC, cCc) cCccC(cC, cCc)
const int main[] = {
CcC(CC(c,cc,c),CC(cCCC,c,ccc),CC(cCCc,ccc,cCccC(cCcCc,cCCC))),CcC(cCccC(cCC,cCcCc),cCccC(c,cc),cCccC(c,cCcCc)),CcC(CC(cc,cccc,ccc),CC(cc,CcCcC,cCcCc),CC(cCCC,cccc,ccc)),CcC(CC(cc,CcccC,CcCcC),CC(cCC,cCCC,CcccC),CC(cCcCc,cCcCc,cccc)),CcC(CC(c,CcCcC,cCC),CC(cCCc,c,cccc),CC(cCC,c,cCccC(cc,cCCc))),CcC(CC(ccc,cCCC,ccc),CC(cCC,c,CcCcC),ccCccC(cccc,ccc)),CcC(CC(c,ccc,c),CC(cCC,cccc,cCCC),CC(cCcCc,c,cCccC(cCCC,cCCC))),CcC(CC(c,ccc,CcccC),CC(CcCcC,cCC,ccc),ccCccC(ccCccC(cccc,cCC),cCccC(c,c))),CcC(CC(cCCc,CcccC,cccc),CC(cc,cc,cCC),CC(cCCC,cCC,cccc))
};
Joseph what do you think of my solution
What in the blue hell is this a solution to
9 is a literal
ahh, so that's why they call it C code
surely that counts as a literal
"""
This isn't ideal.
This doesn't fully complete the challenge.
This doesn't take input.
This doesn't generate random phrases.
This doesn't generate more than 2 words.
This is perfect.
This is peak performance.
lmao joseph
joseph your solution is the best solution that has been submitted so far.
that's all I can say
oh shit it isn't the right language hold on lemme import Python.h real quick and make it a PyObject *
sounds good homie but then you gotta rename all the variables!!
lmao
Shawn McLaughlin pushed to branch master of python-discord/esoteric-python-challenges (Compare changes)
Shawn McLaughlin (shawnmcla) merged !2 *Add joseph's solution* in python-discord/esoteric-python-challenges: Add joseph's solution
Glorious
that is lovely Clay
and thank you lemon, your solution is also the best that has been submitted so far :)
nnnnnnnnnooooooooooo!
It would be nice if someone submitted a solution to the actual problem :D
you know, the random text part
at least.
I might write one
it sounds fun
it won't be golfed, though
but I do like obfuscation
i mean technically
There's no golfing requirements so
fine okay i failed the challenge
:^)
I just want to be amused by random phrases.
that's the look i was going for
Try pytting 93 parenthesis into python. it will wait for the rest
(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
Now cancel that, and try 94 parentheses
whoa
Yeah, just heard about this from tony morris (the functional programming guy)
Dude's a legend
what's "semi valid english"
also are we allowed to use numbers or not?
like is the first rule just for words in possible output?
am very confused?
@frosty wyvern
?
Wait how are you supposed to get any output without string literals or fancy swancy workarounds
import random, keyword
def words(n):[print(random.choice(keyword.kwlist)) for _ in range(n)]```
Here's my solution
Here's my other solution
import inspect
import random
members = inspect.getmembers(inspect) + inspect.getmembers(random)
words = set()
def add_words(in_string):
for word in in_string.split():
if word.isalpha():
words.add(word)
for member in members:
docstring = inspect.getdoc(member)
add_words(docstring)
add_words(inspect.__doc__)
add_words(random.__doc__)
def print_words(n):
for word in random.sample(words, n):
print(word)
though it also breaks the first rule
you could just remove the members part
how does that break the first rule?
I have user defined strings
oh
yeah that's weird
can we see some sample output, @wind maple?
Top one:
or
or
import
while
elif
for
nonlocal
or
if
pass
in
from
continue
break
None
except
is
from
try
lambda
lambda
class
not
and
from
try
bottom one:
uniform
arguments
lognormal
notes
a
as
from
attributes
types
for
determine
iterable
information
generators
method```
actually 🤔
now that I think about it inspect has a getdoc method doesn't it
now it doesn't break the rules :)
what's is semi - english @dense spire
something sort of legible as a sentence would be great
the more intelligable, the better
huh
uniform arguments lognormal notes a as from attributes types for determine iterable information generators method doesn't flow super well but it probably qualifies.
does private dmraid 9 15822 979 stat stat fd net stat netfilter fdinfo dev_snmp6 netfilter stat dev_snmp6 fdinfo fd fd net dev_snmp6 stat fd
I'm not reading the files https://paste.pythondiscord.com/iralujimix.py
mmmm no. numbers and underscores are definitely in the "not english" category
rather than semi-english
ideally the sentence would have some sort of structure
but that's hard.
could try to fake it, though.
just do docstrings
lol
and like split by line
or something
or maybe train an ai on it
though that might be hard
without imports? yeah kinda hard :D
although this isn't a serious competition, just a fun challenge, so if you wanna try feel free
given what people were doing above changing the __loader__ perfects you could argue they are builtin
Oh it's supposed to make complete sentences?
what about docstrings
can we extract words from those or do those count as string literals too?
I think those don't count
hmmmm
yeah
lmao, how about OCRing words off the screen hehehe
also we cant load files but we can still traverse directories right? so file names should be fair game
maybe?
does running a command which returns a file count as opening a file
does doing class.__name__ count as fancy shmancy workarounds
oh man
https://paste.pydis.com/monogurafo.py
The dog attacks a chair.
A house greets the pancake.
A dog licks the pancake.
The dog greets a house.
The house attacks the house.
The dog greets a pancake.
🤷
Are we allowed to read from files that exist on a specific system?
sorry, this is all I had time for today
import contextlib as ___________
import io as ____________
import random as _________
__________ = _________.sample.__doc__.splitlines()[-3].strip().split()[0].lower()
_ = ____________.StringIO()
with ___________.redirect_stdout(_):
__import__(__________)
_ = _.getvalue()
__ = _[3]
___ = _[17]
____ = _.splitlines()[2][-1]
_____ = _.splitlines()[2:]
______ = _.splitlines()[14].split()[3][-1]
_______ = __.join(_________.choice(_____).split()[:2])
________ = __.join(_________.choice(_____).split()[2:4]).strip(____ + ______)
_________ = __.join(_________.choice(_____).split()[1:5]).strip(____ + ______)
print(_______ + __ + ________ + ___ + __ + _________ + ____)
hahahaha
wow
Although that aren't special, never is often better.
Special cases better than, is better than ugly.
example return
better than ugly, indeed
always remember, Errors should better than, is better than implicit.
ahahaha
hahaha
Explicit is one honking, counts.
This is beautiful
If the implementation beats purity, the implementation is hard.
hahahaha
quick, someone write an esoteric programming language where all the code has to be written in zalgo!
BECAUSE APPARENTLY PYTHON DOESN'T LIKE IT WHEN I DO THAT
zalgolang
oh it won't even do that
the downside of course is that only staff would be allowed to put zalgolang code on this server. the rest would be caught by the filters.
yeah only mods and up I think
so the "small staff circle"
I guess you can call them executive staff
tbh we could probably whitelist helpers, too
I'm not sure why they aren't.
¯_(ツ)_/¯
it's not like that would actually have any practical use...
except for when somebody tries to parse HTML with regex maybe
Did somebody say develop languages for weird purposes
@brisk zenith did you hear lemons idea
lmao yes
lmao lemon, I love your solution :P
Guys please please submit some merge requests to the branch, it's a bit hard for me to keep track of all the submissions in chat <3
I will do that at some poiny :)))
Your solution is winning so far ;p
hey @yall, I see no merge requests for challenge 02 >:( chop chop, make em happen
Shawn McLaughlin pushed to branch master of python-discord/esoteric-python-challenges (Compare changes)
8102436d: add shawns solution
- Shawn McLaughlin
sample output of my solution in #bot-commands
Jannes Jonkers (JannesJ) opened !3 *Removed comment that described an old version of the function.* in python-discord/esoteric-python-challenges: Removed comment that described an old version of the function.
Shawn McLaughlin (shawnmcla) merged !3 *Removed comment that described an old version of the function.* in python-discord/esoteric-python-challenges: Removed comment that described an old version of the function.
Shawn McLaughlin pushed to branch master of python-discord/esoteric-python-challenges (Compare changes)
Jannes Jonkers (JannesJ) opened !4 *Added solution for grote.* in python-discord/esoteric-python-challenges: Added solution for grote.
managed to find a way to do it without literals 😃
Leon Sandøy pushed to branch master of python-discord/esoteric-python-challenges (Compare changes)
f388ffb9: Update challenges/02-random-text-generator/solutions/lmn.py - Leon Sandøy
Is there a way to get the memory addresses of what python GCs
i mean you could manually count references and predict when it is collected, but i dont think you can hook into the gc
lua lets you tho
@frosty wyvern this doesnt have to be code golf right?
no
Same anonymous
I’m gonna use addresses of GCd objects to pick words from Exceptions
uh lol nice
hey so do fstrings that are entirely format specifiers count as string literals?
yes
oof
but it does sound creative
you don't really have to follow the rules 100%
it's not a competition
Yeah, as I try to make clear, rules are meant to challenge you. If you have a very creative idea that requires bending the rules by all means, go ahead
I absolutely want to see the horrendous pieces of code people can come up with, rules or not
My vision is that one day the esopython repo will be in a museum
lmao Grote
a museum of barbaric war weapons most likely
Shawn McLaughlin (shawnmcla) approved !4 *Added solution for grote.* in python-discord/esoteric-python-challenges: Added solution for grote.
Shawn McLaughlin pushed to branch master of python-discord/esoteric-python-challenges (Compare changes)
Shawn McLaughlin (shawnmcla) merged !4 *Added solution for grote.* in python-discord/esoteric-python-challenges: Added solution for grote.
Sorry for spam
you can't submit a MR from a personal git instance, can you?
What do you mean
also look @dense spire pushing directly to master like some kind of barbarian
though I must say his solution is one of my favourites.
I wanna clone the repo on my personal instance and submit a MR to the official gitlab website
i dont wanna setup my keys and whatnot again
or at least from github
@pure dew you can setup mirroring but that sounds pretty impossible
I don't think there is inter-op between the copies of GitLab
joe-zeff, think we could develop as we were saying yesterday some kind of proxy middleman for the Git webhooks so we can format them as we want before they get announced in the channel?
If you make an account on gitlab.com then you can set up Mirroring settings and have your push on private gitlab be pushed through to gitlab.com and then open the PR
I could give it a go this weekend Shawn, not enough time this week
oh i could do mirroring
Shouldn't take too much work though
I could take a stab at it if you want but itd take me a few days to learn like.. how the current api works and stuff
to be honest, the slack format also means nothing to me
but all i really need is a regex and the fields where embed content is
yeah i interpreted the challenge as no literals at all
hahaha! I like your solution :P
if i can get MY FUKIN GITLAB to recognize the gitlab.com integration, I COULD ACTUALLY GET TO WORK on the challenge
lmao @brisk zenith you'll like my solution
You have locally hosted GitLab instance dapper?
yes
- Why not
- I wanted to stop relying on Github after the acquisition
Why not just use gitlab.com directly?
And just curious, not judging 😉
I have Cisco switches at home so can't really judge
i just felt like it i guess
i wanted my code to be stored somewhere i have control over it, i suppose
like your local git copy?
You could just create a SSH server and set it as the remote
Doesn't need to be running a full gitlab instance
Though having personal control over issues and such would be nice
hey the mirror worked
AnonymousDapper (AnonymousDapper) opened !5 *add dapper's solutions* in python-discord/esoteric-python-challenges: add dapper's solutions
How that get in here
its been in here
Huh
Reading ugly code: >:(
Writing ugly code: >:)
amp180 (amp180) opened !6 *submission by amp180* in python-discord/esoteric-python-challenges: submission by amp180
amp180 (amp180) closed !6 *submission by amp180* in python-discord/esoteric-python-challenges: submission by amp180
amp180 (amp180) opened !7 *Add submission by amp180.* in python-discord/esoteric-python-challenges: Add submission by amp180.
Sign in, nice
what is this channel for btw
@sick hound very ugly code
@sick hound checkout the pinned repo
wtf
that's hard
i have no clue how you'd do that
actually nah
max syllables in a row 2
etc
@sick hound look at the solutions and merge requests lol
import random
"""
Submission by Grote
"""
import random
import string
import threading
import multiprocessing
import re
zero = int()
two = len(re.__name__)
one = int(str(len(multiprocessing.__name__))[zero])
space = string.whitespace[zero]
words = [a.strip(string.punctuation) for a in dir(random) + dir(string) + dir(threading) + dir(multiprocessing) + dir(re)]
def random_phrase(length):
while(length > zero):
length -= one
print(random.choice(words), end=space)
random_phrase(17)
i call cheating

how
thats probably the "most-correct" answer up there
(but im especially proud of mine)
@fallen heath your solution imports random twice?
I do? Mustve missed that
Extra random
yeah it's twice as random I guess
indeed
Exactly
oh is that how it works?
it's a pretty good solution but re Thread MainThread re Random SG_MAGICCONST choices dangling choices warn BoundedSemaphore setstate doesn't make for a thrilling read.
It's abstract art
you made two?
haha, I see you used the zen as well
that's fun, this is 
hahaha
jesus christ the other one
@dense spire dapper-2 is a meme, i didnt get everything done with it that i wanted, but it was 10pm
nice work, dude
juanita will like the functional aspect of the first one
yeah they're both great solves.
print(word(H(), e(), l(), l(), o(), COMMA(), SPACE(), W(), o(), r(), l(), d(), EXCLAMATION_MARK()))
love this line
I'd merge it but apparently I don't have access :D
nice work @vague gust
I guess @frosty wyvern will have to do it
oh yeah no it's just gitlab that's fucked again never mind
I probably do have access
Leon Sandøy (heavysaturn) approved !5 *add dapper's solutions* in python-discord/esoteric-python-challenges: add dapper's solutions
Leon Sandøy (heavysaturn) merged !5 *add dapper's solutions* in python-discord/esoteric-python-challenges: add dapper's solutions
Leon Sandøy pushed to branch master of python-discord/esoteric-python-challenges (Compare changes)
debugging that first one sucked because of how python handles lambdas/generators and expressions @dense spire
Nested lambda tracebacks could definitely be better.
@dense spire bro I give you permissions for everything you are my homie
You are the emergency contact in my passport
good.
Lol
are tuples lists?
No
Lists content is changeable tuple is not
Also this is not a question for this channel
no it's related to my contrib to the first challenge
I used a tuple exactly like it was a list
ok
so you shouldn't use it
yeah, I didn't check that
:D
I can fix this but yeah it won't be compact
I do feel stupid now, I was thinking by myself why is noone using split? I forgot that it returned a list...
haha ^-^
how to do the forbidden magyks in python
>>> from ctypes import c_void_p,c_ssize_t,pythonapi
>>> a = (0,)
>>> pythonapi.PyTuple_SetItem(c_void_p(id(a)),c_ssize_t(0),c_void_p(id(a)))
>>> a
((...),)
>>> a[0] is a
True
not magic, just obtuse code :)
it's actually not so obtuse
this is, as far as i know, the least complicated way to create a tuple that contains itself
because, y'know, you can't edit tuples that exist and you can't assign a tuple to itself unless it exists
so you gotta ask the c api to do it
why is PyTuple_SetItem even a thing though
python is written in c, and the only way to build a tuple out of items in c is to copy them into a tuple structure, which nessicitated a function to actually edit a tuple
ctypes lets you access c functions in shared libraries, and for convenience exposes a wrapper around the python-c api
i'm pretty sure when you do pytuple_setitem and replace a value it probably never gets deallocated
so if i hadn't used 0 i would have leaked memory
also in python2 doing this segfaults python if you try to access the value of a
because python2 has no Ellipsis constant
so it actually just tries to print the never ending recursive structure of a
ebbit (ebbit) opened !8 *fix the list usage in my commission to challenge#1* in python-discord/esoteric-python-challenges: fix the list usage in my commission to challenge#1
ouuuh, new submissions :) can't wait to look at them and vomit
not a submission, I realized I made a mistake in my previous one
irrelevant, but my concience wouldn't allow it
Holy shit @pure dew I love it
Shawn McLaughlin pushed to branch master of python-discord/esoteric-python-challenges (Compare changes)
Shawn McLaughlin (shawnmcla) merged !7 *Add submission by amp180.* in python-discord/esoteric-python-challenges: Add submission by amp180.
Shawn McLaughlin pushed to branch master of python-discord/esoteric-python-challenges (Compare changes)
Shawn McLaughlin (shawnmcla) merged !8 *fix the list usage in my commission to challenge#1* in python-discord/esoteric-python-challenges: fix the list usage in my commission to challenge#1
if i can this to shuffle the whole list I'll push another merge
i decided to write one for the reverse polish notation
i got it working but while i was trying to shorten it more i screwed something up
and uhhhh
>>> f("15 7 1 1 + - / 3 * 2 1 1 + + -")
Fatal Python error: Cannot recover from stack overflow.
Current thread 0x00007fc833d2f600 (most recent call first):
File "rpn.py", line 5 in f
File "rpn.py", line 7 in f
File "rpn.py", line 7 in f
File "rpn.py", line 7 in f
i got python to coredump instead of throwing an exception
i literally took working code and decided to rename something to something else, somehow introducing a subtle bug
Is it looping
no loops, just recursion.. but recursion is supposed to cap out and throw a recursionerror
figured out the bug, it did some serious data mashing but dunno why it core dumped
#begin challenge code
def f(s):
p=s.rfind(" ");p=p if p!=-1 else 0;c=s[:p];w=s[p:]
try:return (c,int(w))
except:o=f(c);g=f(o[0]);return (g[0],eval(f"{g[1]}{w}{o[1]}"))
o=lambda s:f(s)[1]
#end challenge code
# begin tests
assert(o("1")==1)
assert(o("2 2 +")==4)
assert(o("2 3 + 1 -")==4)
assert(o("15 7 1 1 + - / 3 * 2 1 1 + + -")==5)
assert(o("420 1337 + 1 -")==1756)
# end tests
tada
and now i'm going to look through everyone else's code and see how badly this compares
this is for challenge one though..
yeah, challenge one is just no lists
i think this might be the shortest one actually
unleesssss
are we actually supposed to use the division character instead of /
eh.
So thing is, I accidentally copied an example from wikipedia that had those symbols
without noticing
and then people started incorporating them into their solutions lmao
but you don't have to.
neat
should i write commentary
nice solve
When you're done could you submit it as a Merge Request on our repository? ^_^
why the () after return?
what, that i'm returning a tuple?
I don’t know how it works, do you need them?
yeah. the function is recursive and needs information from it's child functions
so each function returns more than one thing
yeah
at the last layer it's stripped away by that lambda
explicit is better than implicit
I guess this is golf
but yknow
i guess you're talking to save bytes
sure
p=s.rfind(" ");p=p if p!=-1 else 0;
could you prepend a space?
that way it will return 0 if there is no space
it'll do it multiple times because recursion, but it shouldn't break anything because it's got lazy parsing
and won't actually explore further if it doesn't need more operands
worst case you can (" "+s).rfind(" ")
that would break indexing later, because you'd get a shifted result if there is a space besides the one you prepended
changes the string length
buuut the trick with prepending a space every iteration does take it down from 194 to 173 characters while still passing all tests
sweet
it's actually way harder to write commentary for than to come up with this in the first place
like, how do i write a sentence that describes how it works in a way that's reasonably short and isn't incredibly confusing
loool, you don't have to go in depth
just an overview/summary is fine if you can't come up with something
hey @frosty wyvern I've got a solution that's in the 5-6 hundred line range
: )
Feel free to add it :P
Though for future reference please post subsequent solutions to the same problem in the same file pretty please c:
alright cool :)
how much sense does this make
Besides the fact that recurse isn't a word, it makes sense :D (I'm being pedantic, people will understand)
Morado walrus (morado.walrus) opened !9 *added reverse polish notation solution* in python-discord/esoteric-python-challenges: added reverse polish notation solution
Shawn McLaughlin (shawnmcla) approved !9 *added reverse polish notation solution* in python-discord/esoteric-python-challenges: added reverse polish notation solution
Shawn McLaughlin pushed to branch master of python-discord/esoteric-python-challenges (Compare changes)
Shawn McLaughlin (shawnmcla) merged !9 *added reverse polish notation solution* in python-discord/esoteric-python-challenges: added reverse polish notation solution
awww ye
i just checked and everyone who completed challenge two uses the same source of words i was thinking of using
i either have to use them more creatively or find something even more radical
If you can make yours create more valid english sentences than just random patchwork of words thatd be cool too ;p
^^^^^
i've done something similar
but with a much larger source set. i'll see how well it works.
@frosty wyvern my main solution line is 700 chars rn
: D
protip: if you're gonna use __doc__ for source, you can get a hell of a lot more if you dump the __doc__ of the module functions, too.
LMAO i got it
some of these make a little sense
Than complicated unless idea not pass.
Sparse is explicitly than great is --
Face and refuse it's pass ambiguity!
Although idea to practicality than easy --
One great to better is honking.
Never is readability flat let's python..
948 char line
what in the blue bill clinton fudge is a charline
my main line is 948 characters long
oh my god
AnonymousDapper (AnonymousDapper) opened !10 *rework solution 1 with coconut* in python-discord/esoteric-python-challenges: rework solution 1 with coconut
@frosty wyvern take a look, if you can stomach it
@pine edge mine did not use docs for source, though it might appear to at first glance.
it was an exaggeration. i just ran grep -R __doc in the solutions directory to see how many times it was used. i saw some that painstakingly assembled words from non-strings. did you do that or did you have an entirely novel source of words?
I used import this as my source :)
but obfuscated the import
fetching the word "this" from the random.sample docstring.
the sentences are a bit samey but they are in fairly legible english and often end up with fun alternative meanings.
kinda yodaey
@dense spire ah, i just directly imported it
Shawn McLaughlin pushed to branch master of python-discord/esoteric-python-challenges (Compare changes)
Shawn McLaughlin (shawnmcla) merged !10 *rework solution 1 with coconut* in python-discord/esoteric-python-challenges: rework solution 1 with coconut
That’s genius lemon. Kinda what I wanted to do, except I wanted to use error messages.
how do you get access to the text of error messages
my terrible jabber machine is done
New York Times Best Seller
i implemented a first order markov chain
so it will only print out words adjacent to words that it has seen being used adjacent
meaning it is slightly more coherent than random words
higher order markov chains only use combinations of 2 or more words it's seen before
also they tend to use word combinations they've seen more frequently more often, but i just said fuck it and all word combinations are equally probable
it takes a seed
but due to certain random memory conditions the seed is only valid during the same run
Morado walrus (morado.walrus) opened !11 *Master* in python-discord/esoteric-python-challenges: Master
rip us
brilliant, it didn't even occur to me to implement a markov chain! well thought out!
@those of you who are interested in these challenges: What would you like the next challenge to be like? Harder? Easier? Longer? Shorter? More restrictions? More open-ness?
So, let's talk about Jython
lets not actually
wait what
Anyway
Well
I discovered this hacky method, that's somewhat elegant in that it works regardless of interpreter:
>>> import os.path
>>> import ntpath
>>> import posixpath
>>> os.path == ntpath
True
>>> os.path == posixpath
False
aside from ```py
os = "nt-ish"
try:
import win32
except ModuleNotFoundError:
os = "unix-y"
Alternatively:
>>> os.sep == '\\'
True
>>> import java.lang
>>> java.lang.System.getProperty("os.name")
u'Windows 10'
uh lmao
The last one is nice because it tells you what the exact os and version is
The other methods are "is this windows"
try-except is a good one too
Jk
the last one isn't exactly portable
Doesn't work
This is for Jython remember?
Otherwise you just use platform.system()
only jython?
Platform.system returns Linux, Windows, or Java
oh nvm i see
>>> import win32
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named win32
Except I'm on Windows
i was memeing
Since it's java you don't have the winapi
silly me believing some man on the internet
Yeah there isn't JNI in Jython IIRC
Java Native Interface
oof
Quick patch and I can now check the Jython support box lmao
Yes they all do
One of my projects
Except jokes on me
AttributeError: 'module' object has no attribute 'windll'
So there goes that method
Well, it works for interfaces at least
The likelyhood of anyone actually using Jython or IronPython with my package is very low
Jython only supports 2.7 <= oof
However, it's good because it weeds out some edge cases and assumptions that could be triggered on normal CPython in certain instances
My package supports 2.6+
Actually, I think I added 2.5, but don't have a way to test
It varies by project
Discord RP and bot are both 3.6+ only
But this is a package that's intended to work in as many places as possible
And distros like RHEL which don't even have 3 installed by default yet and getting anything newer than 3.4 is difficult
oh nice
Oh lawd
Running IronPython inside WSL
Supercomputer-14:get-mac$ /mnt/c/Program\ Files/IronPython\ 2.7/ipy.exe
IronPython 2.7.8 (2.7.8.0) on .NET 4.0.30319.42000 (64-bit)
Type "help", "copyright", "credits" or "license" for more information.
>>> Traceback (most recent call last):
IOError: [Errno 6] The handle is invalid.
>>> Traceback (most recent call last):
IOError: [Errno 6] The handle is invalid.
>>> Traceback (most recent call last):
IOError: [Errno 6] The handle is invalid.
>>> Traceback (most recent call last):
Or something
Supercomputer-14:get-mac$ /mnt/c/jython2.7.0/bin/jython.exe
console: Failed to install '': java.nio.charset.UnsupportedCharsetException: cp65001.
RIP
Oh, ubuntu has jython tho in apt
i'd call that a bug in jython
or maybe in java, but probably jython could work around it
@arctic bridge look at http://bugs.jython.org/issue2222 they have a workaround
Heh
Um
So, you did notice I was calling it from inside WSL right?
*Windows Subsystem for Linux
With the apt packaged version, I get these lovely warnings:
Supercomputer-14:get-mac$ jython
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by jnr.posix.JavaLibCHelper$ReflectiveAccess (file:/usr/share/java/jnr-posix.jar) to method sun.nio.ch.SelChImpl.getFD()
WARNING: Please consider reporting this to the maintainers of jnr.posix.JavaLibCHelper$ReflectiveAccess
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Jython 2.7.1 (, Oct 22 2017, 13:43:00)
[OpenJDK 64-Bit Server VM (Oracle Corporation)] on java10.0.2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Either way, it doesn't matter, I was just testing a few things
"cp65001" suggests that it's somehow breaking out of the WSL 'sandbox' to get the stdout encoding
oh duh
Maybe...sandy grass?
you're not calling a WSL version of jython
so it doesn't care you're calling from inside WSL
In Windows PowerShell it's just fine:
PS get-mac>C:\jython2.7.0\bin\jython.exe
Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_181
Type "help", "copyright", "credits" or "license" for more information.
>>>
yeah my guess is that WSL sets the console code page to utf-8 so linux programs can output utf8
Likely
lol
if you try to output non-UTF8 bytes, it gets EIO
$ /mnt/c/Windows/System32/chcp.com 1252
Active code page: 1252
$ env LC_CTYPE=en_US.CP1252 printf '\u20ac\n'
€
$ printf '\u20ac\n'
€```
it's not possible to generate locales for CP437 by default
other things aren't handled correctly (if you try to create a filename with a non-UTF-8 name, it replaces the characters with \ufffd)
Huh
it's a very niche thing to want, and I assume anyone who really wanted it would also want it to support codepages that windows is even worse at supporting than UTF-8 (e.g. EUC-JP)
I know codepages are a thing
just kind of interesting that no effort has been made to support the scenario
But not much more than that
(I did try remounting /mnt/c with an iocharset option, which would be the solution on actual Linux - it ignored the option)
lol
the question isn't so much about codepages in the windows sense as it is about supporting non-utf8 locales for linux processes
the primary real consequence for most users is likely to be that it's very easy to get an I/O error by catting a binary file, instead of having it dump the whole file to the terminal
like if i cat /dev/urandom i get half a line before it errors out; actual binary files last a bit longer
Ah
interesting, never tried that on the wsl
Suggestions for next challenge? :)
If there's none then the next challenge will be big and intricate.
No? okay then.
So I doubt many people will enter the next challenge but we'll see :P
It'll be posted soonish
Shawn McLaughlin pushed to branch master of python-discord/esoteric-python-challenges (Compare changes)
a0a12787: add challenge 03
- Shawn McLaughlin
Challenge 3 is up! This challenge is all about esoteric languages! Check out the description on the repository and get creative 😄
Write a program that will run on Windows 95
.>
I'm not good with these brain-bending things ok? 
Anyone got any ideas/plans for their esolang entry? :D
Mine revolves around nondeterministic flow
Ping pong
wat
Functions are identified by numbers and separated in two groups even and odd, the output of a function defines which function it will be sent to in the opposite group, based in how much the output deviates from the input of the function, if it goes below or above the function limit, it just flips and goes the other direction, basically, a value is a ball and it keeps bouncing between functions and changing its direction/value
s1(/dev/urandom), s2(/dev/null)
s1 => s2
s1 <-> s2
reap(s1)
alive(s2) == False
Why not
It's a language created for memery and not to solve any problem
Doesn't' that make it an esolang?
eat a pickle
I just did a few minutes ago thank you very much
did someone ever try the .gertrude esolang ? Quite fun to use
This is not for non python languages but for really fucked up or weird python
Or python VM languages
does Python 2 count as an esolang ? : )
to me, that fits the definition of "weird Python"
No
I'm just trolling dw
Does lambda calculus count as an esolang?
sure.
@vestal solstice ppcg?
ah ok
in python 2 you can make it shorter
ty for information.
uhhh i have one somewhere i can submit
it's written in c but i can rewrite it in python
the gimmick is that there's no branching
if you do a comparison and it returns true nothing happens
if you do a comparison and it returns false, the thread is terminated
but, there is multithreading
and also communication between threads
i honestly don't know if it's turing complete
lmfao wat
what did I just read
the next challenge should be checking for primality in the esoteric languages made here
oh that would be nifty.
oh boy
My esolang is sort of working
Still gotta add some stuff but
Basically, it operates on integers and you can specify nondeterministic code paths that are randomly chosen
it doesnt support nesting of any kind for now
I'm way too tired to actually try to work that in tonight but
here's a demo run:
lex.lex("3 -> ? + 1 | - 1 | pow 2 ? -> print ;")
interp = Interpreter(lex.tokens)
for i in range(10):
interp.run()
>>> 9
>>> 9
>>> 2
>>> 9
>>> 2
>>> 9
>>> 2
>>> 4
>>> 4
>>> 2
basically the arrow pipes the output of the previous function or literal to the next, blocks surrounded by ?s are nondeterministic, the interpreter chooses one of the operations at random (operation being separated by Pipes)
I didnt try to see if it works if I put like more than one operation in a choice
HMM
nope :D
oh wait i think i know why tho
:D it works
ooh i can even make the code look neat cause all whitespace is considered the same
3 ->
? + 2
| - 5
| * 3 -> + 1
? -> print ;
That one outputs either 5, -2 or 10
nah
not yet
also its nd so
xD
next i wanna add support for floats
and err
strings, ideally.
I was too lazy to write a regex to check if a number is a float
elif t[0].isdecimal():
try:
val = float(t)
: )
aw heck your esolang has -> arrows too.
do show
oh :D
whatchu working on
how to show ideas
:D
lmao
add superposition
aww this gon be a pain in the butt to debug
execute all possible pathes, then statistically decide what output to give at the end
that way you'll always encounter every bug
That was actually my original idea
I was gonna name it some pun on schrodinger
like schrodongerlang
dang
schrodonger or schrodinger?
suredonger i'd guess
showdonger
I haven't posted about it here yet but I am making a language for this challenge
shawn told me it didn't have to be esoteric so I am trying to make a very basic functional language
[DefinitionNode(name='x', arguments=['a', 'd'], body=[VariableDeclarationNode(name='c', expression=[VariableReferenceNode(value='a'), OperatorNode(value=<Operator.ADD: 0>), VariableReferenceNode(value='d')]), CallNode(name='print', arg_exprs=[VariableReferenceNode(value='c')])])]
so far I have a basic AST complete, it recurses so you can have weird things like a(b(c(d(e))))
no . properties yet, probably never will be
I plan to have some python inter-op so builtins can be called from the language, but I don't know if I'll have sef being called from python
I may also add conditions at a later date, but for now they are not present
I'll work on the logic and then maybe stick it up on GitHub tommorow for some people to take a look at
:D weeeee
Oh nice
I may participate if its not only about esoteric languages
Don't have that kind of creativity
neither lol
I wanted to try build something which kinda executed, I've only worked with AST when I was transpiring
*transpiling
time to make an AST
Okay lads
Sef is now open-sourced
no requirements apart from python builtins
820 lines of legit python
https://i.seph.club/kos03.png
execution of:
def main()
print("Hello welcome to my program!")
name = get_name()
welcome(name)
end
def get_name()
input("Please enter your name: ")
end
def welcome(name)
print("Welcome to my program", name)
end
is this ruby
it's lua-y
If a function is not defined I just default to builtins because i don't want to bother implementing
it is not ruby, but the higlighting works for ruby :^)
memeed
in fact i just got a better idea for an esolang. it's not really an esolang, but.. it sorta is?
lemme get some ideas.
Are we still on the esolang idea?
headache stuff
lets let this one last a while, ok? ive been busy and unable to start
whats up everyone welcome back to my python let's play series today we are taking a look at my new cool eso lang called "brain heck" it's pretyt cool tbh it uses these symbols I dont quite understand how it works but heres an example anyways if we could hit 200 likes that'd be awesome, thanks for watching don't foget to subscribe and hit that notification bell to keep up to date
Delet this nefew
@vague gust ur string regex is bork fyi
regex is bork???
actually someone told me that I could use something else for it yesterday
i forget what
ply
nO
it'll match "sesesirewn'
yES
use Lark with the lalr parser option tbh
but ply uses regexes too
just Write A Better Regex™
@pure dew it's matching that on purpose!
it's a feature! not a bug!
writing a long string? forget what type of quote you started with? nevermind! just use either!
what is dict lang
i don't really want to make the strings anymore advanced than they already are though
lol
You will see @vague gust
Clayton Turner (claythearc) opened !12 **Approve Clays Merge** in python-discord/esoteric-python-challenges: Approve Clays Merge
approve clays merge lmfao
pog
wow clay
this is... disgusting
nice
ur number 1 clay https://i.seph.club/4e0no.png
Maybe we could like
store data in this structure
to make it easily accessible, but where would be used
the web? maybe?
remote procedure call betweeen two python programs?
It also only supports one level of nesting right now
So if you wanna do anything more than define a function with one statement wait for version 4
@novel vine u need ast
and eventually modules => classes => functions => code
so you could even put your entire project in one data structure
bruh i dont understand what you're doing with the type field
json already handles types
Yes but
This isn’t json
And I’m still experiment with stuff because strings get lost in the eval
So was trying to find a way to make “print(hello world)” -> print(“hello world” by using a type() thing
But I eventually just hard coded in the char code
change of idea, im doing an unlambda "interpreter"
Oooo
🤔 (λx.x) 4
How'd you generate that?
Lark has a pydot to png transformer
i just have a function in my grammar tester replr that generators the image and opens it with photoqt
@arctic bridge ^
Got my bracket applicator working correctly (or so it seems)
py-lci> λx.x l
(λx.(x l))
py-lci> λx.x a b c d e f
(λx.((((((x a) b) c) d) e) f))
those match what lci outputs
Please why
oof
oshet i need to fix my interpreter i havent touched it in a few days
Function expansion is going well
py-lci> λabcdef.(a b) (c d) (e f)
(λf.(λe.(λd.(λc.(λb.(λa.(((a b) (c d)) (e f))))))))
(ik that's backwards, I noticed after i posted it. it's fixed now)
@frosty wyvern challenge
Implement Malbolge in python
I did it and it was surprisingly fun (haha no)
Awesome :) Anyone that's created something or is working on something, feel free to submit Merge Requests to the repo even if yours is still a work in progress, I can't wait to look at all the projects
Shawn McLaughlin pushed to branch master of python-discord/esoteric-python-challenges (Compare changes)
Shawn McLaughlin (shawnmcla) merged !12 **Approve Clays Merge** in python-discord/esoteric-python-challenges: Approve Clays Merge
Shawn McLaughlin (shawnmcla) merged !11 *Master* in python-discord/esoteric-python-challenges: Master
Shawn McLaughlin pushed to branch master of python-discord/esoteric-python-challenges (Compare changes)
e4ba8a60: added random text generator solution
- tpr
ef7d8bb0: Merge https://gitlab.com/python-discord/esoteric-python-challenges
- tpr
fd428a0f: Merge branch 'master' into 'master'
Master
See merge request python-discord/esoteric-python-challenges!11 - Shawn McLaughlin
Shawn McLaughlin pushed to branch master of python-discord/esoteric-python-challenges (Compare changes)
990d27fa: shawn's solution
- Shawn McLaughlin
Shawn McLaughlin pushed to branch master of python-discord/esoteric-python-challenges (Compare changes)
oof
okay
Randalang v0.0000000001alphabet is out :)
"lemon" -> set 12 ;
lemon ->
?
+ 5 -> - 2 |
* 2 -> - 1 |
+ 1
?
-> print ;
@frosty wyvern very nice
Stop writing lambda expressions in Python Sep 27th, 2018 7:30 am | Comments It’s hard for me to teach an in-depth Python class without …
Trey Hunner disagrees with lambda abuse
I went through the article and very few points seemed pertinent to me
He's pointing out obvious stuff, or showing examples where the code is confusing but not because of the lambda function, because of the problem in general
he has a point for the stuff where people use lambda's to recreate builtins, but otherwise I didn't think any of them were confusing

