STINNER Victor added the comment:

> we need to move some optimizations from bytecode level to AST level

You may be aware that there is a long list of similar (old) issues proposing 
something similar:
https://www.python.org/dev/peps/pep-0511/#usage-1-ast-optimizer

My PEP 511 tries to propose a generic API to support all proposed optimizations.

--

I didn't try yet to do something like importlib to compile an AST optimizer 
written in Python into a frozen module and then use it in Python. It would 
allow to implement an AST optimizer in pure Python to ease its maintenance 
*and* have it builtin into CPython, rather than having to play with AST in C 
(less fun).

My plan for the PEP 511 is more to start to experiment multiple AST optimizers 
and bytecode optimizers outside CPython, wait until the code becomes more 
stable, and later discuss if one optimizer deserves to become part of Python 
stdlib.

"Writing an optimizer or a preprocessor is out of the scope of this PEP."

--

But maybe you would prefer to have a single and simple AST optimizer builtin 
Python without new additional API?

I don't want to block your effort on experimentation :-) I just see a nice 
opportunity to sell you the PEP 511 ;-)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26297>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to