mirror of
https://github.com/python/cpython.git
synced 2025-09-29 19:56:59 +00:00
Remove workaround for defaults in namedtuple now that we have the defaults parameter (GH-13263)
This commit is contained in:
parent
6220c02e09
commit
3099ae4075
1 changed files with 0 additions and 9 deletions
|
@ -1017,15 +1017,6 @@ fields:
|
||||||
.. versionchanged:: 3.5
|
.. versionchanged:: 3.5
|
||||||
Property docstrings became writeable.
|
Property docstrings became writeable.
|
||||||
|
|
||||||
Default values can be implemented by using :meth:`~somenamedtuple._replace` to
|
|
||||||
customize a prototype instance:
|
|
||||||
|
|
||||||
>>> Account = namedtuple('Account', 'owner balance transaction_count')
|
|
||||||
>>> default_account = Account('<owner name>', 0.0, 0)
|
|
||||||
>>> johns_account = default_account._replace(owner='John')
|
|
||||||
>>> janes_account = default_account._replace(owner='Jane')
|
|
||||||
|
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
* See :class:`typing.NamedTuple` for a way to add type hints for named
|
* See :class:`typing.NamedTuple` for a way to add type hints for named
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue