Raymond Hettinger added the comment:

FWIW, we intentionally decided not to do this when constant folding was added.  
The idea was to keep the peephole optimizer simple and to have it do the 
minimum work necessary to get its job done (optimizing the constants table 
takes extra time to do but doesn't result in faster code).  

Another reason was that aside from contrived examples (such as the OP's 
example), very little real-world code gets any benefit and the benefit tends to 
be very small.  (In other words, no one will actually notice or benefit from 
this patch, but their compilation times will all slow down slightly).

Lastly, the intention is to stop building out constant folding.  The correct 
place for constant folding is upstream, using AST prior to code generation.

----------
nosy: +rhettinger

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

Reply via email to