←back to thread

101 points _ZeD_ | 5 comments | | HN request time: 0.464s | source
1. zdimension ◴[] No.44537739[source]
Did not know that such things could be accomplished by registering a new file coding format. Reminds me of https://pypi.org/project/goto-statement/
replies(3): >>44538009 #>>44538014 #>>44540340 #
2. zahlman ◴[] No.44538009[source]
This one is arguably even more of a hack; it's working at the source code level rather than the AST level.

The "coding" here is a bytes-to-text encoding. The Python lexer expects to see character data; you get to insert arbitrary code to convert the bytes to characters (or just use existing schemes the implement standards like UTF-8).

3. ◴[] No.44538014[source]
4. crabbone ◴[] No.44540340[source]
I think there's a package to treat Jupyter notebooks as source code (so you can import them as modules).

While the OP package is obviously a joke, the one with notebooks is kind of useful. And, of course, obligatory quote about how languages that don't have meta-programming at the design level will reinvent it, but poorly.

replies(1): >>44541430 #
5. Y_Y ◴[] No.44541430[source]
You talking about this?

https://jupyter-notebook.readthedocs.io/en/stable/examples/N...