[Python-Dev] A Hygienic Macro System in Python?
Skip Montanaro
skip@pobox.com
Mon, 18 Mar 2002 15:45:40 -0600
Tom> define macro unless
Tom> { unless (?test:expression) ?:body end }
Tom> => { if (~ ?test) ?body end }
...
Tom> I find using 'unless' makes some things more readable. To learn the
Tom> internals of the compiler I've been adding an unless statement to
Tom> Python, but one shouldn't need to do this in order to add useful
Tom> constructions like this.
Try this on for size:
http://groups.google.com/groups?hl=en&ie=ISO-8859-1&oe=ISO-8859-1&frame=right&th=e4809653296a3b71&seekm=mailman.1016132066.3225.python-list%40python.org#link1
It may allow you to do some things like unless without messing around with
the compiler proper, though it is clearly nothing more than a neat little
hack.
Skip