[issue2719] Backport next()

Alexander Belopolsky report at bugs.python.org
Wed Apr 30 19:13:50 CEST 2008


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

On Wed, Apr 30, 2008 at 12:41 PM, Guido van Rossum
<report at bugs.python.org> wrote:
> the iternext slot is designed to return NULL without setting an
>  exception.

This is not what the documentation says:

"""
iternextfunc PyTypeObject.tp_iternext
An optional pointer to a function that returns the next item in an
iterator, or raises StopIteration when the iterator is exhausted.
""" <http://docs.python.org/dev/c-api/typeobj.html#tp_iternext>

It looks like documentation needs to be updated, but wouldn't it be
odd to specify that setting StopIteration exception is optional?  It's
probably more logical to intercept StopIteration in slot_tp_iternext
rather than at every place where tp_iternext is called.

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2719>
__________________________________


More information about the Python-bugs-list mailing list