diff options
author | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2019-01-31 00:59:50 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-31 00:59:50 -0800 |
commit | 0bb4bdf0d93b301407774c4ffd6df54cff947df8 (patch) | |
tree | 174cc59b599a8f9aa223eb0f24c90fccb5e8701f /Lib/collections | |
parent | bpo-33504: fix wrong "versionchanged" (GH-11712) (diff) | |
download | cpython-0bb4bdf0d93b301407774c4ffd6df54cff947df8.tar.gz cpython-0bb4bdf0d93b301407774c4ffd6df54cff947df8.tar.bz2 cpython-0bb4bdf0d93b301407774c4ffd6df54cff947df8.zip |
bpo-35864: Replace OrderedDict with regular dict in namedtuple() (#11708)
* Change from OrderedDict to a regular dict
* Add blurb
Diffstat (limited to 'Lib/collections')
-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 c31d7b79185..835cc363d10 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.' |