[Python-Dev] AST optimizer implemented in Python

Nam Nguyen bitsink at gmail.com
Sat Aug 11 23:14:22 CEST 2012


On Sat, Aug 11, 2012 at 11:47 AM, Gregory P. Smith <greg at krypto.org> wrote:
>
> On Sat, Aug 11, 2012 at 11:30 AM, Victor Stinner <victor.stinner at gmail.com>
> wrote:
>>
>> Hi,
>>
>> I started to implement an AST optimizer in Python. It's easy to create
>> a new AST tree, so I'm surprised that I didn't find any existing
>> project.
>>
>> https://bitbucket.org/haypo/misc/src/tip/python/ast_optimizer.py
>
>
> Neat!
>
> +1  We should add some form of setastoptimizer API in 3.4.  Please start a
> PEP for this.  It would be nice to include the ability to properly cache the
> ast optimizer output so that it does not have to run every time (in pyc
> files or similar, etc) but can verify that it is the specific ast optimizer
> that ran on a give existing cached copy.

Once .pyc is created, I do not think that we keep the AST around any
longer. Otherwise, I wouldn't have to write PyXfuscator.

https://bitbucket.org/namn/pyxfuscator

Or perhaps I am misunderstanding you.

Nam


More information about the Python-Dev mailing list