Kaydet (Commit) 63b0a2eb authored tarafından Georg Brandl's avatar Georg Brandl

#2727: clarify tp_iternext docs.

üst 28e0873f
...@@ -753,11 +753,12 @@ set. ...@@ -753,11 +753,12 @@ set.
.. cmember:: iternextfunc PyTypeObject.tp_iternext .. cmember:: iternextfunc PyTypeObject.tp_iternext
An optional pointer to a function that returns the next item in an iterator, or An optional pointer to a function that returns the next item in an iterator.
raises :exc:`StopIteration` when the iterator is exhausted. Its presence When the iterator is exhausted, it must return *NULL*; a :exc:`StopIteration`
normally signals that the instances of this type are iterators (although classic exception may or may not be set. When another error occurs, it must return
instances always have this function, even if they don't define a :meth:`next` *NULL* too. Its presence normally signals that the instances of this type
method). are iterators (although classic instances always have this function, even if
they don't define a :meth:`next` method).
Iterator types should also define the :attr:`tp_iter` function, and that Iterator types should also define the :attr:`tp_iter` function, and that
function should return the iterator instance itself (not a new iterator function should return the iterator instance itself (not a new iterator
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment