Re: Help with the AST re decorators

Jeremy Hylton <[email protected]> Sat, 2 Apr 2005 12:18:26 -0500
Newsgroups gmane.comp.python.compiler
Message-ID <[email protected]>
On Apr 1, 2005 8:57 PM, Neil Schemenauer <[email protected]> wrote:
> I'm trying to add support to the AST compiler for decorators.  I'm
> stuck in trying to represent them in ASDL.  This is what I currently
> have:
> 
>         stmt = FunctionDef(decorator* decorators, identifier name,
>                            arguments args, stmt* body)

I've been wondering if decorators and default argument values should
be nodes that wrap a function call.  The argument in favor of this
approach is that they are in a different block that the function body
and arguments.  It complicates the visitor code in several places
because you have to evaluate parts of the FunctionDef in one
namespace, then enter the function's namespace and continue.

Jeremy