PEP 260: simplify xrange()

Grant Griffin not.this at seebelow.org
Wed Jun 27 23:02:54 EDT 2001


Roman Suzi wrote:
> 
> On Tue, 26 Jun 2001, Guido van Rossum wrote:
> 
...
> >Proposed Solution
> >
> >    I propose to strip the xrange() object to the bare minimum.  The
> >    only retained sequence behaviors are x[i], len(x), and repr(x).
> 
> What about str(x)?

To me, "str" seems kindda like a companion for "repr", so if repr is
supported, my intuition says that str should be also.  However, the
current implementation of it doesn't seem very useful:

	>>> str(xrange(5))
	'xrange(5)'

which, coincidently, looks a lot more like:

	>>> repr(xrange(5))
	'xrange(5)'

than:

	>>> str(range(5))
	'[0, 1, 2, 3, 4]'

In any case, I have never used xrange for anything but the ordinary
"for" loop.

if-even-that-<wink>-ly y'rs,

=g2
-- 
_____________________________________________________________________

Grant R. Griffin                                       g2 at dspguru.com
Publisher of dspGuru                           http://www.dspguru.com
Iowegian International Corporation            http://www.iowegian.com



More information about the Python-list mailing list