PEP 260: simplify xrange()
Tim Peters
tim.one at home.com
Tue Jun 26 20:27:10 EDT 2001
[Mark 'Kamikaze' Hughes]
> Looks reasonable - are there any uses of the advanced behaviors in
> the standard libraries?
Heh. I expect Guido would say "braindead" instead of "advanced" <wink>.
I was amazed to find that-- outside of the test suite --there are fewer than
two dozen uses of xrange() in the entire distribution. I was even more
amazed to find that almost all of them were added by me! All but one are of
the "for yadda in xrange():" variety. The exception is types.py's necessary
but unique
XRangeType = type(xrange(0))
Apart from that, I know of several instances of spead-freak code not in the
distribution (and not mine either) that does
infinity = xrange(sys.maxint) # or even via the default-arg trick
for whatever in whatchamacallit:
for i in infinity:
yadda yadda yadda
if youbetcha:
break
I figure that will still work.
> ...
> You know, this is one of the things that amazes me about Python -
> you actually *remove* features that aren't useful.
He *wants* to -- not always possible, though. For example, Guido has little
use for anything but floating-point numbers, but all the crybaby users keep
whining for more string features <wink>.
i-may-be-able-to-channel-him-but-for-some-reason-he-never-lets-me-
speak-for-him-ly y'rs - tim
More information about the Python-list
mailing list