This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients Adrian Wielgosik, rhettinger, serhiy.storchaka
Date 2016-11-27.18:09:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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.
Date User Action Args
2016-11-27 18:09:45rhettingersetrecipients: + rhettinger, serhiy.storchaka, Adrian Wielgosik
2016-11-27 18:09:45rhettingersetmessageid: <>
2016-11-27 18:09:45rhettingerlinkissue28813 messages
2016-11-27 18:09:45rhettingercreate