[Python-checkins] r67782 - in python/branches/py3k/Doc/tutorial: datastructures.rst modules.rst
georg.brandl
python-checkins at python.org
Mon Dec 15 09:28:37 CET 2008
Author: georg.brandl
Date: Mon Dec 15 09:28:37 2008
New Revision: 67782
Log:
#4667: fix some 2.x leftovers in the tutorial.
Modified:
python/branches/py3k/Doc/tutorial/datastructures.rst
python/branches/py3k/Doc/tutorial/modules.rst
Modified: python/branches/py3k/Doc/tutorial/datastructures.rst
==============================================================================
--- python/branches/py3k/Doc/tutorial/datastructures.rst (original)
+++ python/branches/py3k/Doc/tutorial/datastructures.rst Mon Dec 15 09:28:37 2008
@@ -440,9 +440,9 @@
value associated with that key is forgotten. It is an error to extract a value
using a non-existent key.
-Preforming ``list(d.keys())`` on a dictionary returns a list of all the keys
+Performing ``list(d.keys())`` on a dictionary returns a list of all the keys
used in the dictionary, in arbitrary order (if you want it sorted, just apply
-the :meth:`sort` method to the list of keys). To check whether a single key is
+the :meth:`sorted` function instead). To check whether a single key is
in the dictionary, use the :keyword:`in` keyword.
Here is a small example using a dictionary::
@@ -458,6 +458,8 @@
>>> tel
{'guido': 4127, 'irv': 4127, 'jack': 4098}
>>> list(tel.keys())
+ ['irv', 'guido', 'jack']
+ >>> sorted(tel.keys())
['guido', 'irv', 'jack']
>>> 'guido' in tel
True
Modified: python/branches/py3k/Doc/tutorial/modules.rst
==============================================================================
--- python/branches/py3k/Doc/tutorial/modules.rst (original)
+++ python/branches/py3k/Doc/tutorial/modules.rst Mon Dec 15 09:28:37 2008
@@ -112,7 +112,7 @@
For efficiency reasons, each module is only imported once per interpreter
session. Therefore, if you change your modules, you must restart the
interpreter -- or, if it's just one module you want to test interactively,
- use :func:`reload`, e.g. ``reload(modulename)``.
+ use :func:`imp.reload`, e.g. ``import imp; imp.reload(modulename)``.
.. _tut-modulesasscripts:
More information about the Python-checkins
mailing list