[Python-ideas] Enabling access to the AST for Python code

Greg greg.ewing at canterbury.ac.nz
Fri May 22 04:13:12 CEST 2015


On 22/05/2015 1:57 p.m., Ben Hoyt wrote:
> But I was definitely thinking more along the lines of a "co_ast"
> attribute on code objects. The new syntax approach might be fun, but
> I'd think it's a lot more challenging and problematic to add new
> syntax.

Advantages of new syntax:

* More flexible: Any expression can be made into an AST,
   not just lambdas or genexps.

* More efficient: No need to carry an AST around with
   every code object, the vast majority of which will
   never be used.

Disadvantages of new syntax:

* All the disadvantages of new syntax.

-- 
Greg



More information about the Python-ideas mailing list