Why in Python is the iterator exhaustion fixed by calling StopIteration
, and not by implementing the IsDone()
method on the iterator, as written in GoF Design Patterns?
Raising an exception is still a rather expensive operation.
Why in Python is the iterator exhaustion fixed by calling StopIteration
, and not by implementing the IsDone()
method on the iterator, as written in GoF Design Patterns?
Raising an exception is still a rather expensive operation.