On Sun, Jul 14, 2002 at 03:23:25AM -0700, Andrew P. Lentvorski wrote: > 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? +1 IndexError is probably better than inventing a new exception. The description of what actually happened would be in the exception text. StopIteration means "That was the last item, thank you. Sorry I couldn't tell you my length in advance -- I'm an iterator and I don't even know it myself." This type of IndexError would mean "Hey, I told you it was the last item. This would have been an out-of-bounds index if I were a sequence". Oren
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