[issue26722] Fold compare operators on constants (peephole)

Raymond Hettinger report at bugs.python.org
Sat Apr 9 20:19:43 EDT 2016


Raymond Hettinger added the comment:

AFAICT, the cases the OP listed would be rarely found in real code. 

Victor is correct is saying that we want to limit the scope of the peepholer to the most useful cases.  

He is also correct in saying that we've long desired constant folding to be moved upstream to the AST and don't want to go further down the path of doing more work at the bytecode level.  Ideally, the only optimizations at the peephole level would be limited to rejuggling opcodes into cheaper execution sequences without regard to higher level object semantics.

I recommend rejecting this and suggesting that more effort be focused on the AST optimizations.

----------
nosy: +rhettinger
priority: normal -> low

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26722>
_______________________________________


More information about the Python-bugs-list mailing list