Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3099ae4

Browse files
andresdelfinocsabella
authored andcommitted
Remove workaround for defaults in namedtuple now that we have the defaults parameter (GH-13263)
1 parent 6220c02 commit 3099ae4

1 file changed

Lines changed: 0 additions & 9 deletions

File tree

Doc/library/collections.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,15 +1017,6 @@ fields:
10171017
.. versionchanged:: 3.5
10181018
Property docstrings became writeable.
10191019

1020-
Default values can be implemented by using :meth:`~somenamedtuple._replace` to
1021-
customize a prototype instance:
1022-
1023-
>>> Account = namedtuple('Account', 'owner balance transaction_count')
1024-
>>> default_account = Account('<owner name>', 0.0, 0)
1025-
>>> johns_account = default_account._replace(owner='John')
1026-
>>> janes_account = default_account._replace(owner='Jane')
1027-
1028-
10291020
.. seealso::
10301021

10311022
* See :class:`typing.NamedTuple` for a way to add type hints for named

0 commit comments

Comments
 (0)