[Python-Dev] Termination of two-arg iter()

Aahz aahz@pythoncraft.com
Tue, 16 Jul 2002 10:34:36 -0400


On Tue, Jul 16, 2002, Oren Tirosh wrote:
>
> I consider the StopIteration sink state to be a silent error. It
> makes an exhausted iterator behave just like an iterator of an empty
> sequence.  Because iterators and iterables can be mixed freely it
> results in silent failures when a function that requires a re-iterable
> object gets an iterator.  Iterables can serve as a replacement for
> sequences in most cases.  When they are not I'd like to get an error,
> please.

So the real problem isn't that you can't distinguish between an empty
iterator and an exhausted one, but that you can't distinguish between
re-iterable objects and objects that can't be re-iterated.  If my
understanding of your POV is correct, you can't get there from here.
You're talking about two different concepts and conflating them, which
to my mind breaks, "Simple is better than complex," and, "Beautiful is
better than ugly."

Your sole hope IMO, is to get behind Alex's bandwagon so that there is a
mechanism available for documenting such behaviors at the code level.
-- 
Aahz (aahz@pythoncraft.com)           <*>         http://www.pythoncraft.com/

Project Vote Smart: http://www.vote-smart.org/