mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Issue #24931: Resolve __dict__ conflict in namedtuple subclasses.
This commit is contained in:
parent
1a83746418
commit
7a3602e7cf
4 changed files with 19 additions and 14 deletions
|
@ -816,10 +816,10 @@ field names, the method and attribute names start with an underscore.
|
|||
.. method:: somenamedtuple._asdict()
|
||||
|
||||
Return a new :class:`OrderedDict` which maps field names to their corresponding
|
||||
values. Note, this method is no longer needed now that the same effect can
|
||||
be achieved by using the built-in :func:`vars` function::
|
||||
values::
|
||||
|
||||
>>> vars(p)
|
||||
>>> p = Point(x=11, y=22)
|
||||
>>> p._asdict()
|
||||
OrderedDict([('x', 11), ('y', 22)])
|
||||
|
||||
.. versionchanged:: 3.1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue