On Sun, 14 Jul 2002, Brett Cannon wrote: > end. It seems like StopIteration is saying "stop please" and > IteratorExhausted would be like screaming "STOP CALLING .next()!!!". What about raising IndexError by default when someone attempts to call .next() on an iterator already raising StopIteration? In the case of a list, StopIteration signals that the iterator is pointing to just beyond the end of the list. An attempt to call .next() when StopIteration is already true is effectively an attempt to dereference past the end of a list (since .next() normally wants to return a value). List accesses via an index past list end currently raise an IndexError. Doing something similar for iterators would seem to keep things consistent. -a
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