Comment on PEP-0322: Reverse Iteration Methods

David Eppstein eppstein at ics.uci.edu
Sat Sep 27 03:08:22 EDT 2003


In article <dp6db.7740$541.7674 at nwrdny02.gnilink.net>,
 "Raymond Hettinger" <vze4rx4y at verizon.net> wrote:

> [Raymond]
> > >    It crashes when applied to an infinite iterator.
> 
> [Steve Holden]
> > Hmm. My little brain is having difficulty imagining anything that won't.
> > What am I missing?
> 
> The PEP proposes adding a method only to a few objects
> that don't have degenerate cases:  list, str, unicode, xrange
> and possibly tuple.

Speaking of which: str, int, etc., used to be functions, but they got 
changed to be the initializers of types having those names.  Why is 
xrange still a function rather than the initializer of the xrange type?

The most visible difference of changing xrange to be the type of the 
xrange objects would be more information shown in help(xrange), some of 
which could be useful if we are talking about adding more methods to the 
xrange objects.

-- 
David Eppstein                      http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science




More information about the Python-list mailing list