[Python-checkins] r62602 - python/trunk/Doc/c-api/typeobj.rst

georg.brandl python-checkins at python.org
Wed Apr 30 22:02:38 CEST 2008


Author: georg.brandl
Date: Wed Apr 30 22:02:37 2008
New Revision: 62602

Log:
#2727: clarify tp_iternext docs.


Modified:
   python/trunk/Doc/c-api/typeobj.rst

Modified: python/trunk/Doc/c-api/typeobj.rst
==============================================================================
--- python/trunk/Doc/c-api/typeobj.rst	(original)
+++ python/trunk/Doc/c-api/typeobj.rst	Wed Apr 30 22:02:37 2008
@@ -753,11 +753,12 @@
 
 .. cmember:: iternextfunc PyTypeObject.tp_iternext
 
-   An optional pointer to a function that returns the next item in an iterator, or
-   raises :exc:`StopIteration` when the iterator is exhausted.  Its presence
-   normally signals that the instances of this type are iterators (although classic
-   instances always have this function, even if they don't define a :meth:`next`
-   method).
+   An optional pointer to a function that returns the next item in an iterator.
+   When the iterator is exhausted, it must return *NULL*; a :exc:`StopIteration`
+   exception may or may not be set.  When another error occurs, it must return
+   *NULL* too.  Its presence normally signals that the instances of this type
+   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
    function should return the iterator instance itself (not a new iterator


More information about the Python-checkins mailing list