STINNER Victor added the comment:

Hi, it looks like the author of the peephole optimizer is Raymond Hettinger and 
he doesn't look to want to handle too many cases, he prefers to keep the code 
simple.

FYI I reimplemented recently the peephole optimizer in pure Python as part of 
the bytecode project:
https://bytecode.readthedocs.org/en/latest/peephole.html

I didn't write it to replace the C implementation, it was more a tool to 
discuss modifying bytecode (when discussing the PEP 511).

More generally, there is an ongoging discussion of rewriting the peephole 
optimizer to work on the AST rather than working on the Python code. The FAT 
Python implements that in pure Python:
https://faster-cpython.readthedocs.org/fat_python.html

FAT Python is more than a peephole optimizer, it's more a framework to 
implement more optimizations. Well, take a look.

----------

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

Reply via email to