←back to thread

101 points _ZeD_ | 1 comments | | HN request time: 0.248s | source
Show context
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 #
1. 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).