PEP 260: simplify xrange()

Andrew Dalke dalke at acm.org
Tue Jun 26 23:21:39 CEST 2001


Guido van Rossum wrote
>    In particular, these behaviors will be dropped:
>
>        x[i:j] (slicing)

This is the only one on the drop list I might think is
useful.  However, I just searched our code and all uses of
'xrange' were in the context 'for i in xrange(' so we've
no need for any other features.  Plus, implementing xrange
is so simple that upon consideration now I won't even claim
that slicing might be useful.

>        x*n, n*x (sequence-repeat)
>        cmp(x1, x2) (comparisons)
> i in x (containment test)
>        x.tolist() method
>        x.start, x.stop, x.step attributes

Never used any of these features and never needed them.

                    Andrew
                    dalke at acm.org






More information about the Python-list mailing list