question about xrange performance

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Sat Apr 18 02:40:32 EDT 2009


Paul McGuire:

>xrange is not really intended for "in" testing,<

Let's add the semantic of a good and fast "in" to xrange (and to the
range of Python3). It hurts no one, allows for a natural idiom
(especially when you have a stride you don't want to re-invent the
logic of skipping absent numbers), and it's readable.

My xrange() I have written in D language has a fast OpIn_r() method. I
haven't found any bad side effect to such capability yet.

Bye,
bearophile



More information about the Python-list mailing list