[Python-Dev] Meta coding in Python

Nick Coghlan ncoghlan at gmail.com
Fri Sep 16 01:12:20 CEST 2011


On Fri, Sep 16, 2011 at 8:44 AM, Albert Zeyer <albzey at googlemail.com> wrote:
> Hi list,
>
> I thought it would be nice in Python to allow some sort of meta coding
> (which goes far ahead of simple function descriptors).
>
> The most straight forward way would be to allow operations on the AST.

1. This kind of suggestion is more appropriately directed to python-ideas
2. We already support this, look at the ast module and in particular
the ast.PyCF_ONLY_AST flag to the compile() builtin function. For an
example of advanced usage, look at the py.test module and it's
meta-importer that rewrites assert statements

Regards,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list