[Python-checkins] r86650 - python/branches/py3k/Doc/library/collections.rst
raymond.hettinger
python-checkins at python.org
Mon Nov 22 00:23:30 CET 2010
Author: raymond.hettinger
Date: Mon Nov 22 00:23:29 2010
New Revision: 86650
Log:
Issue 6722: Improve the namedtuple examples.
Modified:
python/branches/py3k/Doc/library/collections.rst
Modified: python/branches/py3k/Doc/library/collections.rst
==============================================================================
--- python/branches/py3k/Doc/library/collections.rst (original)
+++ python/branches/py3k/Doc/library/collections.rst Mon Nov 22 00:23:29 2010
@@ -586,11 +586,15 @@
.. versionchanged:: 3.1
Added support for *rename*.
-Example:
.. doctest::
:options: +NORMALIZE_WHITESPACE
+ >>> # Basic example
+ >>> Point = namedtuple('Point', 'x y')
+ >>> p = Point(x=10, y=11)
+
+ >>> # Example using the verbose option to print the class definition
>>> Point = namedtuple('Point', 'x y', verbose=True)
class Point(tuple):
'Point(x, y)'
More information about the Python-checkins
mailing list