summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-04-04 23:46:34 +0000
committerBenjamin Peterson <benjamin@python.org>2009-04-04 23:46:34 +0000
commitf9c8193b76beaf2585c2747d0645faf86e237d64 (patch)
treecc66d2173bed8067b740421bfa5c4c47afed9b6b
parent91a1a071a0ff21899b981f6adaa93b8a5f32eae8 (diff)
downloadcpython-git-f9c8193b76beaf2585c2747d0645faf86e237d64.tar.gz
note how using iter* are unsafe while mutating and document iter(dict)
-rw-r--r--Doc/library/stdtypes.rst14
1 files changed, 14 insertions, 0 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index af84f4f0d7..ae3856ce8e 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -1928,6 +1928,11 @@ pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:
.. versionadded:: 2.2
+ .. describe:: iter(d)
+
+ Return an iterator over the keys of the dictionary. This is a shortcut
+ for :meth:`iterkeys`.
+
.. method:: clear()
Remove all items from the dictionary.
@@ -1980,6 +1985,9 @@ pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:
Return an iterator over the dictionary's ``(key, value)`` pairs. See the
note for :meth:`dict.items`.
+ Using :meth:`iteritems` while adding or deleting entries in the dictionary
+ will raise a :exc:`RuntimeError`.
+
.. versionadded:: 2.2
.. method:: iterkeys()
@@ -1987,6 +1995,9 @@ pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:
Return an iterator over the dictionary's keys. See the note for
:meth:`dict.items`.
+ Using :meth:`iterkeys` while adding or deleting entries in the dictionary
+ will raise a :exc:`RuntimeError`.
+
.. versionadded:: 2.2
.. method:: itervalues()
@@ -1994,6 +2005,9 @@ pairs within braces, for example: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098:
Return an iterator over the dictionary's values. See the note for
:meth:`dict.items`.
+ Using :meth:`itervalues` while adding or deleting entries in the
+ dictionary will raise a :exc:`RuntimeError`.
+
.. versionadded:: 2.2
.. method:: keys()