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 ncoghlan
Recipients Jeremy.Hylton, Trundle, alex, benjamin.peterson, brett.cannon, daniel.urban, dmalcolm, eltoder, eric.snow, georg.brandl, gregory.p.smith, jcon, mark.dickinson, meador.inge, nadeem.vawda, ncoghlan, pitrou, rhettinger, santoso.wijaya, techtonik, terry.reedy, vstinner
Date 2012-09-06.01:45:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1346895936.78.0.623295097149.issue11549@psf.upfronthosting.co.za>
In-reply-to
Content
The peephole optimiser already makes optimisations like that in a couple of places (e.g. set -> frozenset):

>>> def f(x):
...    if x in {1, 2}: pass
...
>>> f.__code__.co_consts
(None, 1, 2, frozenset({1, 2}))

It's name lookup semantics that are the real minefield. It's one of the reasons PyPy's JIT can be so much more effective than a static optimiser - because it's monitoring real execution and inserting the appropriate guards it's not relying on invalid assumptions about name bindings.
History
Date User Action Args
2012-09-06 01:45:36ncoghlansetrecipients: + ncoghlan, brett.cannon, georg.brandl, rhettinger, terry.reedy, gregory.p.smith, mark.dickinson, pitrou, vstinner, techtonik, nadeem.vawda, benjamin.peterson, alex, Trundle, dmalcolm, meador.inge, daniel.urban, Jeremy.Hylton, santoso.wijaya, eltoder, eric.snow, jcon
2012-09-06 01:45:36ncoghlansetmessageid: <1346895936.78.0.623295097149.issue11549@psf.upfronthosting.co.za>
2012-09-06 01:45:36ncoghlanlinkissue11549 messages
2012-09-06 01:45:35ncoghlancreate