2 ms·
I take it you prefer the explicit test for the end of iteration? As an historic note, the StopIteration form grew out of the earlier iterator form, which calle
by dalke 11y ago
I take it you prefer the explicit test for the end of iteration?
As an historic note, the StopIteration form grew out of the earlier iterator form, which called __getitem__ with successive integers until there was an IndexError. That may explain a bias towards an exception-based approach.
- pvg 11y agoI probably do, although in practice, given how well (and composable) python comprehensions/iterators/generators have turned out, getting all worked up about some implementation detail now seems a bit churlish and pointless.