[Python-Dev] Enable access to the AST for Python code

Steve Dower Steve.Dower at microsoft.com
Fri May 22 02:45:05 CEST 2015


The semantics could be the same while the execution plan is different, just like numba compiled code runs with the same semantics as the original.

A better way of getting the AST than decompiling byte code is all that's being asked for. Maybe not easy to do in the general case, but certainly not an unreasonable request.

Cheers,
Steve

Top-posted from my Windows Phone
________________________________
From: Greg Ewing<mailto:greg.ewing at canterbury.ac.nz>
Sent: ‎5/‎21/‎2015 17:29
To: python-dev at python.org<mailto:python-dev at python.org>
Subject: Re: [Python-Dev] Enable access to the AST for Python code

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
code as-is.

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
as well.)

--
Greg
_______________________________________________
Python-Dev mailing list
Python-Dev at python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/steve.dower%40microsoft.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150522/e9e025c8/attachment.html>


More information about the Python-Dev mailing list