projects
/
python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
086f308
)
Issue 6722: Improve the namedtuple examples.
author
Raymond Hettinger
<python@rcn.com>
Sun, 21 Nov 2010 23:23:29 +0000
(23:23 +0000)
committer
Raymond Hettinger
<python@rcn.com>
Sun, 21 Nov 2010 23:23:29 +0000
(23:23 +0000)
Doc/library/collections.rst
patch
|
blob
|
history
diff --git
a/Doc/library/collections.rst
b/Doc/library/collections.rst
index e34e39479b05346cb1f2c219bc3ec12f473d05c6..3f81c00c20dc3d3e56ebd928b13540a2f42fc650 100644
(file)
--- 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)'