3 ms·
You might enjoy, in a "never try this in practice" sort of way, some code I did to make a working Python variant, which compiled to Python byte code, and suppor
by dalke 8y ago
You might enjoy, in a "never try this in practice" sort of way, some code I did to make a working Python variant, which compiled to Python byte code, and supported Perl-like pattern match syntax, like:
# get_function_names.py
for line in open("python_yacc.py"):
if line =~ m/def (?P<name>\w+) *(?P<args>\(.*\)) *:/:
print repr($1), repr($args)
See http://dalkescientific.com/Python/python4ply-tutorial.html http://dalkescientific.com/Python/python4ply-tutorial.html .
It got appreciative hisses when I did a lightning talk about it at a PyCon.
FWIW, I co-founded Biopython back in 1999.