[Python-Dev] Enable access to the AST for Python code
greg.ewing at canterbury.ac.nz
Fri May 22 02:28:54 CEST 2015
Ethan Furman wrote:
> I think the key difference is that the AST is not going to be converted
> to run different Python code under Python, but under some other language
> -- presumably to implement the semantics of the Python snippet.
If the semantics were exactly the same as the Python
snippet, there would be no need to convert it to another
language -- you might as well just run the Python
The whole point of this kind of facility is to express
things that you *can't* express the way you would like
using standard Python semantics.
From the user's point of view, it doesn't matter whether
the implementation works by generating Python code, or
generating some other language, or processing the AST
directly. The effect is to assign non-Python semantics
to Python syntax.
(At least is *is* still Python syntax -- I can understand
Guido being wary of letting people redefine the syntax
More information about the Python-Dev