summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2013-10-10 05:43:30 (GMT)
committerRaymond Hettinger <python@rcn.com>2013-10-10 05:43:30 (GMT)
commit5ed3bc9adbb5af56450b918410bf07b2bf54ef54 (patch)
treec02076759671f3ac18194b976d62bf6d60a3ea75 /Doc
parenta61a1cb0845a816c29da407e45b3e52b951ba33e (diff)
parent8ee7708c7f7906f794a4f97ea2f9347e605ee245 (diff)
downloadcpython-5ed3bc9adbb5af56450b918410bf07b2bf54ef54.zip
cpython-5ed3bc9adbb5af56450b918410bf07b2bf54ef54.tar.gz
cpython-5ed3bc9adbb5af56450b918410bf07b2bf54ef54.tar.bz2
merge
Diffstat (limited to 'Doc')
-rw-r--r--Doc/c-api/iter.rst11
1 files changed, 5 insertions, 6 deletions
diff --git a/Doc/c-api/iter.rst b/Doc/c-api/iter.rst
index 3f0f554..2ba444d 100644
--- a/Doc/c-api/iter.rst
+++ b/Doc/c-api/iter.rst
@@ -5,7 +5,7 @@
Iterator Protocol
=================
-There are only a couple of functions specifically for working with iterators.
+There are two functions specifically for working with iterators.
.. c:function:: int PyIter_Check(PyObject *o)
@@ -14,11 +14,10 @@ There are only a couple of functions specifically for working with iterators.
.. c:function:: PyObject* PyIter_Next(PyObject *o)
- Return the next value from the iteration *o*. If the object is an iterator,
- this retrieves the next value from the iteration, and returns *NULL* with no
- exception set if there are no remaining items. If the object is not an
- iterator, :exc:`TypeError` is raised, or if there is an error in retrieving the
- item, returns *NULL* and passes along the exception.
+ Return the next value from the iteration *o*. The object must be an iterator
+ (it is up to the caller to check this). If there are no remaining values,
+ returns *NULL* with no exception set. If an error occurs while retrieving
+ the item, returns *NULL* and passes along the exception.
To write a loop which iterates over an iterator, the C code should look
something like this::