> Maybe, the right way to go is to assure that iter(x) returns a freshly > loaded iterator instead of the same iterator in the same state. That would be a change to the semantics of all iterators, not worth it just to fix a small oddity with xrange. I think it's fairly clear that xrange is to be thought of as a lazy list, *not* an iterator. The best way to fix it (if it needs fixing) is to have iter(xrange(...)) always return a new object, I think. It wouldn't be possible for all iterators to behave the way you suggest, anyway, because some kinds of iterator don't have an underlying sequence that can be restarted (e.g. file iterators). Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+
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