[Python-checkins] r71203 - python/trunk/Doc/library/stdtypes.rst

benjamin.peterson python-checkins at python.org
Sun Apr 5 01:46:34 CEST 2009


Author: benjamin.peterson
Date: Sun Apr  5 01:46:34 2009
New Revision: 71203

Log:
note how using iter* are unsafe while mutating and document iter(dict)

Modified:
   python/trunk/Doc/library/stdtypes.rst

Modified: python/trunk/Doc/library/stdtypes.rst
==============================================================================
--- python/trunk/Doc/library/stdtypes.rst	(original)
+++ python/trunk/Doc/library/stdtypes.rst	Sun Apr  5 01:46:34 2009
@@ -1928,6 +1928,11 @@
 
       .. 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 @@
       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 @@
       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 @@
       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()


More information about the Python-checkins mailing list