homepage

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 dmalcolm
Recipients alex, dmalcolm, pitrou, rhettinger
Date 2010年01月12日.19:36:18
SpamBayes Score 1.0906501e-08
Marked as misclassified No
Message-id <1263324982.39.0.611958258849.issue6690@psf.upfronthosting.co.za>
In-reply-to
Content
Attaching a probably over-simplistic attempt at this patch, against the py3k branch.
This patch attempts to extend the replacement of
 LOAD_CONST, ...., LOAD_CONST, BUILD_LIST, COMPARE_OP(in)
with
 LOAD_CONST(tuple), COMPAREOP(in)
so that it also replaces:
 LOAD_CONST, ...., LOAD_CONST, BUILD_SET, COMPARE_OP(in)
with 
 LOAD_CONST(tuple), COMPAREOP(in)
i.e. using a tuple, not a frozenset (on the grounds that the "in" conditions should at least still work); caveat: I'm relatively new to the innards of this code.
With this patch:
>>> dis.dis(lambda o: o in {1,2,3})
 1 0 LOAD_FAST 0 (o) 
 3 LOAD_CONST 3 ((1, 2, 3)) 
 6 COMPARE_OP 6 (in) 
 9 RETURN_VALUE 
but:
>>> dis.dis(lambda o: o in {1,2,3,3,2,1})
 1 0 LOAD_FAST 0 (o) 
 3 LOAD_CONST 3 ((1, 2, 3, 3, 2, 1)) 
 6 COMPARE_OP 6 (in) 
 9 RETURN_VALUE 
Is it worth me working on a rewrite to use a frozenset.
Hope this is helpful
Dave
History
Date User Action Args
2010年01月12日 19:36:22dmalcolmsetrecipients: + dmalcolm, rhettinger, pitrou, alex
2010年01月12日 19:36:22dmalcolmsetmessageid: <1263324982.39.0.611958258849.issue6690@psf.upfronthosting.co.za>
2010年01月12日 19:36:20dmalcolmlinkissue6690 messages
2010年01月12日 19:36:19dmalcolmcreate

AltStyle によって変換されたページ (->オリジナル) /