[Python-Dev] Termination of two-arg iter()
Fredrik Lundh
fredrik@pythonware.com
Sat, 13 Jul 2002 21:38:31 +0200
tim wrote:
> The question is whether this is intentional: for all other iterators Python
> supplies, StopIteration is a "sink state": once an iterator raises
> StopIteration, calling its next() method any number of times again will just
> continue raising StopIteration.
except SRE's finditer method, that is (also reported on c.l.python)
> Or is that left up to the discretion of the iterator?
if you don't know, it probably is undefined, which means that SRE's
finditer does the best thing possible: accept a few misakes, and then
punish the poor fool who cannot follow instructions. (but to be nice,
cut them a bit more slack if they're to cheap to buy a real operating
system ;-)
</F>