summaryrefslogtreecommitdiffstats
path: root/Lib/collections.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-01-10 20:37:12 (GMT)
committerRaymond Hettinger <python@rcn.com>2008-01-10 20:37:12 (GMT)
commite850c466c7dd25baac71997d6ca073e3586526b5 (patch)
tree523f765bb66dd223d20e10cef3708b5a5fafe279 /Lib/collections.py
parente1655088ca65644312f02a147a0f9ad968cde2d9 (diff)
downloadcpython-e850c466c7dd25baac71997d6ca073e3586526b5.zip
cpython-e850c466c7dd25baac71997d6ca073e3586526b5.tar.gz
cpython-e850c466c7dd25baac71997d6ca073e3586526b5.tar.bz2
Clarify how to add a field to a named tuple.
Diffstat (limited to 'Lib/collections.py')
-rw-r--r--Lib/collections.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/collections.py b/Lib/collections.py
index 47b0397..267c39f 100644
--- a/Lib/collections.py
+++ b/Lib/collections.py
@@ -137,6 +137,9 @@ if __name__ == '__main__':
print Point(11, 22)._replace(x=100)
+ Point3D = namedtuple('Point3D', Point._fields + ('z',))
+ print Point3D.__doc__
+
import doctest
TestResults = namedtuple('TestResults', 'failed attempted')
print TestResults(*doctest.testmod())