[Compiler-sig] Help with the AST re decorators

Jeremy Hylton jhylton at gmail.com
Sat Apr 2 19:18:26 CEST 2005


On Apr 1, 2005 8:57 PM, Neil Schemenauer <nas at arctrix.com> 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


More information about the Compiler-sig mailing list