mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Clarify how to add a field to a named tuple.
This commit is contained in:
parent
e1655088ca
commit
e850c466c7
2 changed files with 4 additions and 1 deletions
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue