News for hackers. Stuff that matters.
Re:WTFPython: Exploring and understanding Python through sur... by satwik on Tuesday May 31, 2022 @02:18AM (#31566614)
Hi, maintainer of the repo here, thanks for sharing :)

If anyone's willing to go through those examples with an interpreter on the side, you can check out https://www.wtfpython.xyz/

It's built with pyiodide, the only limitation is you may not get correct results for the examples that are version-dependent. The UX might not be great, especially on mobile (happy to hear ideas on how to improve it), but it does the job for now :)

Re:WTFPython: Exploring and understanding Python through sur... by albert_e on Tuesday May 31, 2022 @03:16AM (#31566898)
Looks great but one quibble -- the "dark mode" simply flips the black and white of normal webpage and code blocks ... which is 50-50

can we use a different shade of grey for code blocks in dark mode?

Re:WTFPython: Exploring and understanding Python through sur... by satwik on Tuesday May 31, 2022 @07:40AM (#31568382)
Right, I agree with this. Reducing some contrast by using shades of grey will look more pleasant. I'll get this adjusted, thanks for the tip!
Re:WTFPython: Exploring and understanding Python through sur... by Beltiras on Tuesday May 31, 2022 @05:52AM (#31567676)
Thank you for this. Even as a senior Python developer I didn't know many of these.
Re:WTFPython: Exploring and understanding Python through sur... by satwik on Tuesday May 31, 2022 @07:45AM (#31568424)
Glad you found it informative.

I've found senior developers to have polarized opinions about the usefulness of the collection, so always good to see a review in favorable direction :)

Re:WTFPython: Exploring and understanding Python through sur... by Fiahil on Tuesday May 31, 2022 @09:44AM (#31569398)
> in favorable direction

Speaking of directions, how about the bidirectional use of `yield` and `yield from` ?

https://stackoverflow.com/questions/9708902/in-practice-what...

# Sending data to a generator (coroutine) using yield from - Part 1

Re:WTFPython: Exploring and understanding Python through sur... by isoprophlex on Tuesday May 31, 2022 @10:54AM (#31570224)
This is beautiful! I've been known to hate on stuff like that walrus operator being added, but this I love. So clean, simple and powerful. Thanks for sharing.
Re:WTFPython: Exploring and understanding Python through sur... by tetha on Wednesday June 01, 2022 @01:17AM (#31578388)
I also learned a bunch of weird things about python from this, like the really gritty details of assignments and such. It's surprisingly messy once you leave the beaten good path.

I also learned that there is python code which causes a rather violent "Don't you ever get that near a code base I maintain"-reaction, which I much rather associated with perl.

Re:WTFPython: Exploring and understanding Python through sur... by Beltiras on Tuesday May 31, 2022 @07:51AM (#31568465)
Edge cases can keep me awake at night. Reminding oneself that there are no simple things in this enterprise of ours is a good reminder.