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

Ben Hoyt benhoyt at gmail.com
Sat Jul 4 19:47:19 CEST 2015

On Sat, Jul 4, 2015 at 3:46 AM, Neil Girdhar <mistersheik at gmail.com> wrote:

> Thank you.  Has anyone implemented this solution yet?
> On Sat, Jul 4, 2015 at 3:13 AM, Andrew Barnert <abarnert at yahoo.com> wrote:
>> On Jul 3, 2015, at 13:42, Neil Girdhar <mistersheik at gmail.com> wrote:
>> >
>> > There are a lot of messages in this discussion.  Was there a final
>> consensus about how the AST for a given code object should be calculated?
>> I think it depends on what exactly you're trying to do, but using an
>> import hook means you can call compile or ast.parse once and keep it around
>> as well as using it for the compile, so that seems like it should be a good
>> solution for most uses.
Yes, the MacroPy library uses this approach (import hooks to get and modify
the AST):


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150704/135be854/attachment-0001.html>

More information about the Python-ideas mailing list