Message128825
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 |
|
Date |
User |
Action |
Args |
2011-02-18 23:09:25 | pitrou | set | recipients:
+ pitrou, rhettinger, mark.dickinson, r.david.murray, jdharper |
2011-02-18 23:09:25 | pitrou | set | messageid: <1298070565.25.0.371901806068.issue11244@psf.upfronthosting.co.za> |
2011-02-18 23:09:24 | pitrou | link | issue11244 messages |
2011-02-18 23:09:24 | pitrou | create | |
|