question about xrange performance
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Sat Apr 18 12:41:06 EDT 2009
On Sat, 18 Apr 2009 13:05:34 +0200, mmanns wrote:
> On Fri, 17 Apr 2009 23:40:32 -0700 (PDT) bearophileHUGS at lycos.com wrote:
>
>> 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.
>
> A fast "in" to xrange would be great. Why was it taken away?
http://docs.python.org/whatsnew/2.2.html#other-changes-and-fixes
"Some features of the object returned by the xrange() function are now
deprecated, and trigger warnings when they’re accessed; they’ll disappear
in Python 2.3. xrange objects tried to pretend they were full sequence
types by supporting slicing, sequence multiplication, and the in
operator, but these features were rarely used and therefore buggy. The
tolist() method and the start, stop, and step attributes are also being
deprecated. At the C level, the fourth argument to the PyRange_New
function, repeat, has also been deprecated."
You may also want to read these:
http://mail.python.org/pipermail/python-3000/2007-August/009061.html
http://mail.python.org/pipermail/patches/2004-August/015501.html
--
Steven
More information about the Python-list
mailing list