> On Tue, Jun 04, 2002 at 04:08:08PM -0400, Oren Tirosh wrote: > > It seems that the xrange object in the current CVS can't make up its mind > > whether it's an iterator or an iterable: > > In 2.2, xrange had no "next" method, so it got wrapped by a generic > iterator object. It was desirable for performance to have xrange also > act as an iterator. This seems to propagate the confusion. To avoid being wrapped by a generic iterator object, you need to define an __iter__ method, not a next method. The current xrange code (from SF patch #551410) uses the xrange object as both an iterator and iterable, and has an extra flag to make things work right when the same object is iterated over more than once. Without doing more of a review, I can only say that I'm a but uncomfortable with that approach. Something like the more recent code that Raymond H added to listobject.c to add a custom iterator makes more sense. But perhaps it is defensible. --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4