[Python-Dev] Re: Prospective Peephole Transformation
Phillip J. Eby
pje at telecommunity.com
Fri Feb 18 16:36:43 CET 2005
At 10:15 AM 2/18/05 -0500, Raymond Hettinger wrote:
>Only contains expressions are translated:
> "if x in [1,2,3]"
>currently turns into:
> "if x in (1,2,3)"
>and I'm proposing that it go one step further:
> "if x in Seachset([1,2,3])"
ISTM that whenever I use a constant in-list like that, it's almost always
with just a few (<4) items, so it doesn't seem worth the extra effort
(especially disrupting the marshal module) just to squeeze out those extra
two comparisons and replace them with a hashing operation.
More information about the Python-Dev