[Python-Dev] xrange vs generators
Guido van Rossum
guido@digicool.com
Mon, 25 Jun 2001 12:07:44 -0400
> Hmm. I'd rather not endure the resulting complaints without a
> strong rationale for deprecating it. One that strikes close to my
> heart: there's more code in 2.2 to support xrange than there is to
> support generators! But users don't care about that.
But I do, and historically this code has often been bug-ridden without
anybody noticing -- so it's not like it's needed much.
I would suggest to remove most of the fancy features of xrange(), in
particular the slice, contains and repeat slots. A step further would
be to remove getitem also, and add a tp_getiter slot instead --
returning not itself but a new iterator that iterates through the
prescribed sequence.
We need a PEP for this. Anyone? Should be short and sweet.
--Guido van Rossum (home page: http://www.python.org/~guido/)