Show HN: Inline C in Python
quasiquotes.readthedocs.org
quasiquotes.readthedocs.org
Found this example which seems a little clearer: https://pypi.python.org/pypi/quasiquotes/0.2.0
Initially I thought this was something like James Powell's "astexpr" literals example (towards the end of < http://www.youtube.com/watch?v=2O7yj-Nh6AY >), which would require actually implementing a new C-API type, adding parser logic for its literals, and recompiling Python.
If you can add a comment or two to clear up my confusion, I would really appreciate it.
Great work on this!
'[$qq|this is the body|]'.encode('utf-8').decode('quasiquotes') "qq._quote_expr(0,' this is the body')"
I'd be very happy to help better document this stuff in the code. Searching around, there are not very many good documents describing how to create and register a custom decoder.
I have read and re-read your setup.py file a few times now, and followed the trail to the .pth file and to the locations where codecs.register is used. But it's still not clear to me how this functionality gets "installed" such that the decoder hook that parses your decoder's name ("quasiquotes") is able to map that back to the search_function from the installed module's source code.
Basically, how does the codec registry become permanently aware that "quasiquotes" maps to the search function in your installed package?
btw - I suspect a different title might help get more traction on hn - inlining C isn't that interesting (scipy.weave has done this for years) but this approach to inlining is super cool, and can be extended to other langs. none of this is obvious from the title