According to the Python docs, once an iterator raises StopIteration, it
should continue to raise StopIteration forever. Iterators that fail to
behave in this fashion are deemed to be "broken":
I don't understand the reasoning behind this. As I understand it, an
iterator is something like a stream. There's no constraint that once a
stream is empty it must remain empty forever.
Can somebody explain why "broken iterators" are broken?
--
Steven
should continue to raise StopIteration forever. Iterators that fail to
behave in this fashion are deemed to be "broken":
I don't understand the reasoning behind this. As I understand it, an
iterator is something like a stream. There's no constraint that once a
stream is empty it must remain empty forever.
Can somebody explain why "broken iterators" are broken?
--
Steven
Comment