macro FAQ

Jacek Generowicz jacek.generowicz at
Sun Aug 24 11:44:21 CEST 2003

mis6 at (Michele Simionato) writes:

> > Can this be implemented using metaclasses, or any other existing
> > Python mechanism ?
> Yes.

Unfortunately I can't easily access this at the moment. I'll try to
have a look later.

> At the end it uses metaclasses+exec+a simple argument parser based on 
> tokenize. EXPERIMENTAL code, which I would not trust except as proof
> of concept.

If it uses exec, then it is faking up macros.

Lisp macros are little else besides offering language support for the
use of exec for this kind of thing.

If people start resorting to this sort of trick themselves, and
re-inventing it over and over again, then you might as well design it
properly, once and for all, and call it a macro system.

I submit that Python already has macros ... they just need a bit of
streamlining :-)

More information about the Python-list mailing list