diff options
author | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2019-01-31 08:59:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-31 08:59:50 (GMT) |
commit | 0bb4bdf0d93b301407774c4ffd6df54cff947df8 (patch) | |
tree | 174cc59b599a8f9aa223eb0f24c90fccb5e8701f /Lib | |
parent | 0897e0c597c065f043e4286d01f16f473ab664ee (diff) | |
download | cpython-0bb4bdf0d93b301407774c4ffd6df54cff947df8.zip cpython-0bb4bdf0d93b301407774c4ffd6df54cff947df8.tar.gz cpython-0bb4bdf0d93b301407774c4ffd6df54cff947df8.tar.bz2 |
bpo-35864: Replace OrderedDict with regular dict in namedtuple() (#11708)
* Change from OrderedDict to a regular dict
* Add blurb
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/collections/__init__.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py index c31d7b7..835cc36 100644 --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -426,9 +426,11 @@ def namedtuple(typename, field_names, *, rename=False, defaults=None, module=Non 'Return a nicely formatted representation string' return self.__class__.__name__ + repr_fmt % self + _dict, _zip = dict, zip + def _asdict(self): 'Return a new OrderedDict which maps field names to their values.' - return OrderedDict(zip(self._fields, self)) + return _dict(_zip(self._fields, self)) def __getnewargs__(self): 'Return self as a plain tuple. Used by copy and pickle.' |