Clarify how to add a field to a named tuple.

This commit is contained in:
Raymond Hettinger 2008-01-10 20:37:12 +00:00
parent e1655088ca
commit e850c466c7
2 changed files with 4 additions and 1 deletions

View file

@ -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())