diff options
author | Raymond Hettinger <python@rcn.com> | 2010-11-21 23:23:29 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2010-11-21 23:23:29 (GMT) |
commit | 0ef956f9974c649bfc64550f8597cec13cfe21f8 (patch) | |
tree | 8f47c7f87e31ccf3a773adcee856da19f9989a81 | |
parent | 086f30815c0f674326fe78ba83689d0a2a96b8d7 (diff) | |
download | cpython-0ef956f9974c649bfc64550f8597cec13cfe21f8.zip cpython-0ef956f9974c649bfc64550f8597cec13cfe21f8.tar.gz cpython-0ef956f9974c649bfc64550f8597cec13cfe21f8.tar.bz2 |
Issue 6722: Improve the namedtuple examples.
-rw-r--r-- | Doc/library/collections.rst | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst index e34e394..3f81c00 100644 --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -586,11 +586,15 @@ they add the ability to access fields by name instead of position index. .. 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)' |