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 pitrou
Recipients jdharper, mark.dickinson, pitrou, r.david.murray, rhettinger
Date 2011-02-18.23:09:23
SpamBayes Score 0.006986367
Marked as misclassified No
Message-id <1298070565.25.0.371901806068.issue11244@psf.upfronthosting.co.za>
In-reply-to
Content
Here is a patch that enables advanced (recursive) constant folding.
Example:

python -c "import dis; f=lambda x: x in {(3*-5)+(-1-6),(1,-2,3)*2,None};dis.dis(f)"

With 3.1:
  1           0 LOAD_FAST                0 (x) 
              3 LOAD_CONST               7 (-15) 
              6 LOAD_CONST               8 (-7) 
              9 BINARY_ADD           
             10 LOAD_CONST              10 ((1, -2, 3, 1, -2, 3)) 
             13 LOAD_CONST              11 (None) 
             16 BUILD_SET                3 
             19 COMPARE_OP               6 (in) 
             22 RETURN_VALUE         

With 3.2+patch:
  1           0 LOAD_FAST                0 (x) 
              3 LOAD_CONST              14 (frozenset({None, -22, (1, -2, 3, 1, -2, 3)})) 
              6 COMPARE_OP               6 (in) 
              9 RETURN_VALUE
History
Date User Action Args
2011-02-18 23:09:25pitrousetrecipients: + pitrou, rhettinger, mark.dickinson, r.david.murray, jdharper
2011-02-18 23:09:25pitrousetmessageid: <1298070565.25.0.371901806068.issue11244@psf.upfronthosting.co.za>
2011-02-18 23:09:24pitroulinkissue11244 messages
2011-02-18 23:09:24pitroucreate