S
Steve Holden
So you don't think that we should rely on iterables with no __iter__()PEP 255, like too much Python literature, doesn't distinguish clearly
between the language definition and implementation detail. It says
"The mechanics of StopIteration are low-level details, much like the
mechanics of IndexError in Python 2.1". Applications shouldn't be
explicitly using StopIteration.
method to raise IndexError to terminate iterations when their
__getitem__() is called with an invalid index? The IndexError mechanism
was, to the best of my less-than-complete knowledge, used by all pre-2.2
implementations. The quoted paragraph appears to be intended to reassure
the applications programmer that there is no normal need to handle
StopIteration specially - just as there was no need to handle IndexError
specially.
Perhaps not, but the only difference is what happens on repeated callsIronPython doesn't do StopIteration the same way CPython does.
http://ironpython.codeplex.com/wikipage?title=IPy1.0.xCPyDifferences
to next() after the iterator is exhausted. The iterator still terminates
by raising a StopIteration error.
I have no idea what Shed Skin does, but to the extent that iterators
don't raise StopIteration on exhaustion I'd say it is in error.
regards
Steve