[Python-3000-checkins] r57804 - python/branches/py3k/Doc/tutorial/controlflow.rst python/branches/py3k/Doc/tutorial/datastructures.rst

neal.norwitz python-3000-checkins at python.org
Fri Aug 31 05:46:29 CEST 2007


Author: neal.norwitz
Date: Fri Aug 31 05:46:28 2007
New Revision: 57804

Modified:
   python/branches/py3k/Doc/tutorial/controlflow.rst
   python/branches/py3k/Doc/tutorial/datastructures.rst
Log:
A few more fixes to the tutorial

Modified: python/branches/py3k/Doc/tutorial/controlflow.rst
==============================================================================
--- python/branches/py3k/Doc/tutorial/controlflow.rst	(original)
+++ python/branches/py3k/Doc/tutorial/controlflow.rst	Fri Aug 31 05:46:28 2007
@@ -436,8 +436,7 @@
        print("-- I'm sorry, we're all out of", kind)
        for arg in arguments: print arg
        print('-'*40)
-       keys = keywords.keys()
-       keys.sort()
+       keys = sorted(keywords.keys())
        for kw in keys: print(kw, ':', keywords[kw])
 
 It could be called like this::

Modified: python/branches/py3k/Doc/tutorial/datastructures.rst
==============================================================================
--- python/branches/py3k/Doc/tutorial/datastructures.rst	(original)
+++ python/branches/py3k/Doc/tutorial/datastructures.rst	Fri Aug 31 05:46:28 2007
@@ -400,12 +400,12 @@
    >>> tel['irv'] = 4127
    >>> tel
    {'guido': 4127, 'irv': 4127, 'jack': 4098}
-   >>> tel.keys()
+   >>> list(tel.keys())
    ['guido', 'irv', 'jack']
-   >>> tel.has_key('guido')
-   True
    >>> 'guido' in tel
    True
+   >>> 'jack' not in tel
+   False
 
 The :func:`dict` constructor builds dictionaries directly from lists of
 key-value pairs stored as tuples.  When the pairs form a pattern, list
@@ -435,10 +435,10 @@
 ==================
 
 When looping through dictionaries, the key and corresponding value can be
-retrieved at the same time using the :meth:`iteritems` method. ::
+retrieved at the same time using the :meth:`items` method. ::
 
    >>> knights = {'gallahad': 'the pure', 'robin': 'the brave'}
-   >>> for k, v in knights.iteritems():
+   >>> for k, v in knights.items():
    ...     print(k, v)
    ...
    gallahad the pure


More information about the Python-3000-checkins mailing list