mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Fix named tuples to work with vars().
This commit is contained in:
parent
9028928156
commit
3d89057ff8
4 changed files with 7 additions and 1 deletions
|
@ -268,6 +268,8 @@ class {typename}(tuple):
|
|||
'Return a new OrderedDict which maps field names to their values'
|
||||
return OrderedDict(zip(self._fields, self))
|
||||
|
||||
__dict__ = property(_asdict)
|
||||
|
||||
def _replace(_self, **kwds):
|
||||
'Return a new {typename} object replacing specified fields with new values'
|
||||
result = _self._make(map(kwds.pop, {field_names!r}, _self))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue