mirror of
https://github.com/python/cpython.git
synced 2025-08-19 00:00:48 +00:00
Fix named tuples to work with vars().
This commit is contained in:
parent
19b851d11b
commit
45b082935d
4 changed files with 7 additions and 2 deletions
|
@ -312,6 +312,7 @@ def namedtuple(typename, field_names, verbose=False, rename=False):
|
|||
def _asdict(self):
|
||||
'Return a new OrderedDict which maps field names to their values'
|
||||
return OrderedDict(zip(self._fields, self)) \n
|
||||
__dict__ = property(_asdict) \n
|
||||
def _replace(_self, **kwds):
|
||||
'Return a new %(typename)s 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