diff options
author | Raymond Hettinger <python@rcn.com> | 2008-01-10 20:37:12 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2008-01-10 20:37:12 (GMT) |
commit | e850c466c7dd25baac71997d6ca073e3586526b5 (patch) | |
tree | 523f765bb66dd223d20e10cef3708b5a5fafe279 /Doc/library | |
parent | e1655088ca65644312f02a147a0f9ad968cde2d9 (diff) | |
download | cpython-e850c466c7dd25baac71997d6ca073e3586526b5.zip cpython-e850c466c7dd25baac71997d6ca073e3586526b5.tar.gz cpython-e850c466c7dd25baac71997d6ca073e3586526b5.tar.bz2 |
Clarify how to add a field to a named tuple.
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/collections.rst | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst index b276ab0..1e213fb 100644 --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -538,7 +538,7 @@ faster versions that bypass error-checking and that localize variable access:: Subclassing is not useful for adding new, stored fields. Instead, simply create a new named tuple type from the :attr:`_fields` attribute:: - >>> Pixel = namedtuple('Pixel', Point._fields + Color._fields) + >>> Point3D = namedtuple('Point3D', Point._fields + ('z',)) Default values can be implemented by using :meth:`_replace` to customize a prototype instance:: |