Range Operation pre-PEP
thomas at xs4all.net
Wed May 9 09:22:48 CEST 2001
On Tue, May 08, 2001 at 07:49:17PM -0300, Carlos Ribeiro wrote:
> Agreed. In fact, xrange could be internally substituted by iterators.
No, it could not. xrange(1,10) works, iter(range(1,10)) does not:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: unsubscriptable object
xrange isn't an iterator, it's a 'generator' (or a 'lazy list'). I agree
that xrange should adhere to the iteration protocol, but making it *just* an
iterator isn't enough.
Thomas Wouters <thomas at xs4all.net>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
More information about the Python-list