Live data from Hacker News

Python’s Preprocessor

pydong.org

71–80 of 109 posts

Re: Python’s Preprocessor

#72

Earlier quoted context omitted.

Growing old is mandatory; growing up is optional.

Thank you for connecting 2 sayings of Murakami Haruki :) 1.痛みは避けがたいが、苦しみはオプショナル ( https://archive.ph/Ca9rE ) Now, I don’t know how representative this book is of Murakami’s novelistic style, but I wonder: Is this low-maintenance, attention-deficit prose part of Murakami’s attraction, especially among the young? Do people enjoy reading him for the same reason they persist in listening to music as blandly familiar as C…

> as blandly familiar as Clapton’s

If it hadn't been for Clapton, I probably never would've heard of Laylā bint Mahdī bin Saʿd bin Muzahim bin ʿAds bin Rabīʿah bin Jaʿdah bin Ka'b bin Rabīʿah bin Hawāzin bin Mansūr bin ʿAkramah bin Khaṣfah bin Qays ʿAylān bin Muḍar bin Nizār bin Maʿad bin ʿAdnan.

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

Lagniappe: https://www.youtube.com/watch?v=EZ8magpNo10&t=93s

Re: Python’s Preprocessor

#73
post #14

>>> from __future__ import braces File " ", line 1 SyntaxError: not a chance For those interested in how this (hilarious) error text came to be, it's been hardcoded in cpython since 2001! https://github.com/python/cpython/commit/ad3d3f2f3f19833f59f... The author, Jeremy Hylton, is now a Principal Engineer at Google working on AI search quality. It's quite remarkable that in 24 years, a single person's career has gone…

It's always so cool to see this kind of Easter eggs. So sad that they're not as common as they used to be.

There are all sorts of easter eggs and jokes in Python, for example a joke about blind people that GvR prevented from being reverted:

https://marc.info/?l=python-dev&m=130991276326041&w=2

In 2024 suddenly everyone is grown up and corporate and has never done anything wrong.

Re: Python’s Preprocessor

#74
post #61

Earlier quoted context omitted.

Reminds me of `break rust;` causing the Rust compiler to emit an internal compiler error. I wonder which other languages have similar easter eggs.

Tcl really became “Enterprise-ready”[0] at this time. [0] https://stackoverflow.com/a/1026619

> The Stardate time format had nothing to do with Sun. I added it to Tcl while working at Scriptics, as an easter egg for the then-upcoming Tcl2K Conference. One of the conference events was a competition to implement a standard-to-stardate conversion utility, using an arcane formula. Only one guy entered the event. He spent a couple hours agonizing over the implementation (as he was looking for a job at Scriptics, he was eager to impress) only to have the easter egg revealed afterwards. Of course he won the competition anyway. And he got the job, too. – Eric Melski

Re: Python’s Preprocessor

#75

Earlier quoted context omitted.

Reminds me of `break rust;` causing the Rust compiler to emit an internal compiler error. I wonder which other languages have similar easter eggs.

This one in Haskell is coincidental, but used as a joke: ``` import Data.Function main = do let it = fix error print it ```

On HN, you can add code blocks by indenting with 2 spaces:

  import Data.Function

  main = do
    let it = fix error
    print it

Re: Python’s Preprocessor

#76
Huh, that’s convenient and really useful. When I do ridiculous import hacks, i usually just do it be importing a module, that trades the ast module to rewrite code, exec it and shim in an exit(). A preprocessor would be so much more ergonomic.

I used the ast rewriting stuff mostly before dicts were all ordered - replacing fist literals with an ordered dict call, which was actually useful.

I love how flexible python is. Most cursed thing I ever did was mutating strings in place, which led me eventually abusing mmap as well to write scripts that mutated themselves. Now I feel need to write lisp interpreter as a producer.

Re: Python’s Preprocessor

#77
post #14

>>> from __future__ import braces File " ", line 1 SyntaxError: not a chance For those interested in how this (hilarious) error text came to be, it's been hardcoded in cpython since 2001! https://github.com/python/cpython/commit/ad3d3f2f3f19833f59f... The author, Jeremy Hylton, is now a Principal Engineer at Google working on AI search quality. It's quite remarkable that in 24 years, a single person's career has gone…

Reminds me of `break rust;` causing the Rust compiler to emit an internal compiler error. I wonder which other languages have similar easter eggs.

If NLP counts, try xyzzy in gemini.google.com

Re: Python’s Preprocessor

#78
post #14

>>> from __future__ import braces File " ", line 1 SyntaxError: not a chance For those interested in how this (hilarious) error text came to be, it's been hardcoded in cpython since 2001! https://github.com/python/cpython/commit/ad3d3f2f3f19833f59f... The author, Jeremy Hylton, is now a Principal Engineer at Google working on AI search quality. It's quite remarkable that in 24 years, a single person's career has gone…

How is it remarkable? Random people didn't get to add stuff to Python in 2001. It was a niche thing and someone who was contributing to it was likely to be a smart and dedicated person who would naturally have an impactful career ahead of them.

It's a misconception that the informal playful hobby hacking things are their separate world from real professional development.

Re: Python’s Preprocessor

#79

Part of me says that python has not gone out of its way to expose preprocessor hooks for good reason, and reasonable adults should stay away from it. The other part wants nothing to do with reasonable adults anyhow. Such fun could be had.

If you stopped people from doing this the easy/obvious way, they'd attempt it in a worse and more hacky way.
Post reply on HN