diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2013-08-01 19:12:45 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2013-08-01 19:12:45 (GMT) |
commit | 39668f57f445b8a2db63b0d0dc32c55a90d3f59e (patch) | |
tree | d7e9d1e0d5a45955ab883d8fbc5a020cec21df38 /Doc/whatsnew/2.2.rst | |
parent | b3c872403d0d2b00a1a383190d3e14eb94e84df1 (diff) | |
download | cpython-39668f57f445b8a2db63b0d0dc32c55a90d3f59e.zip cpython-39668f57f445b8a2db63b0d0dc32c55a90d3f59e.tar.gz cpython-39668f57f445b8a2db63b0d0dc32c55a90d3f59e.tar.bz2 |
Issue #18589: fix hyperlinking of type slots (tp_*)
Diffstat (limited to 'Doc/whatsnew/2.2.rst')
-rw-r--r-- | Doc/whatsnew/2.2.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/whatsnew/2.2.rst b/Doc/whatsnew/2.2.rst index 2e7069d..31b6df4 100644 --- a/Doc/whatsnew/2.2.rst +++ b/Doc/whatsnew/2.2.rst @@ -450,9 +450,9 @@ signal that the iterator is done. Python classes can define an :meth:`__iter__` method, which should create and return a new iterator for the object; if the object is its own iterator, this method can just return ``self``. In particular, iterators will usually be their -own iterators. Extension types implemented in C can implement a :attr:`tp_iter` +own iterators. Extension types implemented in C can implement a :c:member:`~PyTypeObject.tp_iter` function in order to return an iterator, and extension types that want to behave -as iterators can define a :attr:`tp_iternext` function. +as iterators can define a :c:member:`~PyTypeObject.tp_iternext` function. So, after all this, what do iterators actually do? They have one required method, :meth:`next`, which takes no arguments and returns the next value. When @@ -478,7 +478,7 @@ there are no more values to be returned, calling :meth:`next` should raise the In 2.2, Python's :keyword:`for` statement no longer expects a sequence; it expects something for which :func:`iter` will return an iterator. For backward compatibility and convenience, an iterator is automatically constructed for -sequences that don't implement :meth:`__iter__` or a :attr:`tp_iter` slot, so +sequences that don't implement :meth:`__iter__` or a :c:member:`~PyTypeObject.tp_iter` slot, so ``for i in [1,2,3]`` will still work. Wherever the Python interpreter loops over a sequence, it's been changed to use the iterator protocol. This means you can do things like this:: |