diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2013-08-01 19:14:43 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2013-08-01 19:14:43 (GMT) |
commit | a68cbfa5561434208d7a822128eeabca50bd7a29 (patch) | |
tree | 3bf29283c78d69e9fb94a4e638e9ddf85600db5b /Doc/whatsnew | |
parent | 932ff8368289b53c4ca37167747bb71d146fc6ea (diff) | |
parent | 39668f57f445b8a2db63b0d0dc32c55a90d3f59e (diff) | |
download | cpython-a68cbfa5561434208d7a822128eeabca50bd7a29.zip cpython-a68cbfa5561434208d7a822128eeabca50bd7a29.tar.gz cpython-a68cbfa5561434208d7a822128eeabca50bd7a29.tar.bz2 |
Issue #18589: fix hyperlinking of type slots (tp_*)
Diffstat (limited to 'Doc/whatsnew')
-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:: |