"Jim Weirich" <jweirich / one.net> schrieb im Newsbeitrag
news:1048592848.27719.6.camel / traken...
> Yeah, my tutorial glossed over that part.  Having a standard for
> external iterators will really help them be more useful.  I would
> suggest more? instead of end?.  This allows you to write loops in terms
> of the positive rather than a negative test.  I.e.
>
>    while it.more?

What about "until it.end?"?

> Python iterators throw an exception when they are done.  This means you
> have one less method call to make in a loop.  I'm uncomfortable with the
> exception, it seems to be premature optimization.  However, if you do go
> that route, then I like Julian's use of catch/throw over an exception
> (exceptions in my mind indicate a failure).

Well, if python iterators provide a tester for more elements then an
exception is in order IMHO.  Java iterators do have boolean hasNext() as
well as Object next(). The latter throws if there are no more elements -
trying to get an element after the end is clearly an error, isn't it?

Regards

    robert