
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2019-01-31 02:20 byrhettinger, last changed2022-04-11 14:59 byadmin. This issue is nowclosed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 11708 | merged | rhettinger,2019-01-31 04:25 | |
| PR 11708 | merged | rhettinger,2019-01-31 04:25 | |
| PR 11708 | merged | rhettinger,2019-01-31 04:25 | |
| PR 11720 | merged | python-dev,2019-02-01 11:05 | |
| PR 11720 | merged | python-dev,2019-02-01 11:05 | |
| PR 11720 | merged | python-dev,2019-02-01 11:05 | |
| PR 11720 | merged | python-dev,2019-02-01 11:05 | |
| PR 13046 | merged | rhettinger,2019-05-02 00:28 | |
| Messages (7) | |||
|---|---|---|---|
| msg334602 -(view) | Author: Raymond Hettinger (rhettinger)*![]() | Date: 2019-01-31 02:20 | |
Now that regular dicts are ordered and compact, it makes more sense for the _asdict() method to create a regular dict (as it did in its early days) rather than an OrderedDict. The regular dict is much smaller, much faster, and has a much cleaner looking repr. Historically we would go through a deprecation period for a possibly breaking change; however, it was considered more benefit to users and less disruptive to make the update directly. See the thread starting at:https://mail.python.org/pipermail/python-dev/2019-January/156150.html | |||
| msg334617 -(view) | Author: Raymond Hettinger (rhettinger)*![]() | Date: 2019-01-31 08:59 | |
New changeset0bb4bdf0d93b301407774c4ffd6df54cff947df8 by Raymond Hettinger in branch 'master':bpo-35864: Replace OrderedDict with regular dict in namedtuple() (#11708)https://github.com/python/cpython/commit/0bb4bdf0d93b301407774c4ffd6df54cff947df8 | |||
| msg334694 -(view) | Author: Eric Snow (eric.snow)*![]() | Date: 2019-02-01 16:09 | |
Thanks for doing this, Raymond!FYI, I found a couple of places where it still refers to OrderedDict:1. in the doc entry in collections.rst [1]2. in the docstring [2][1]https://github.com/python/cpython/commit/0bb4bdf0d93b301407774c4ffd6df54cff947df8#diff-a2f0632ea84b755c7ef5b9bd291c7fdfR890[2]https://github.com/python/cpython/commit/0bb4bdf0d93b301407774c4ffd6df54cff947df8#diff-8a750c700ae5ac1d0a14922de83e99ccR432 | |||
| msg334695 -(view) | Author: Eric Snow (eric.snow)*![]() | Date: 2019-02-01 16:24 | |
Also, there's a potentially misleading detail that you might consider correcting in the text. However, making it correct might make it slightly less clear, so it's a bit of a judgement call on how important it is to be explicit here. (FWIW, I think it's worth it to some extent.)The language reference doesn't guarantee that dictionaries are order-preserving (yet). [1] Therefore there can be (are?) Python implementations where dict isn't ordered. Users of those implementations may be confused by the docs (and docstring) saying the method returns a dict.This could be addressed by changing those places to say something like it returns an insertion-ordered mapping. The docs entry would also have an "CPython implementation detail" part saying it's actually a dict in CPython.Since "insertion-ordered mapping" isn't nearly as clear as "dict" (even if more correct), it may make more sense to simply say "dict". However, in that case I'd recommend at the very least to add a "CPython implementation detail" part to the docs entry which says in CPython it returns a dict, but in other implementations it may be some other order-preserving mapping.Honestly, after having written that the latter option seems more sensible. :)[1]https://docs.python.org/3.8/reference/datamodel.html#index-29 | |||
| msg334696 -(view) | Author: Eric Snow (eric.snow)*![]() | Date: 2019-02-01 16:25 | |
If you prefer, I'd be glad to open separate issues for either thing. | |||
| msg334697 -(view) | Author: Eric Snow (eric.snow)*![]() | Date: 2019-02-01 16:28 | |
FWIW, bothPEP 468 (kwargs order) andPEP 520 (class definition order) specify order-preserving mapping rather than dict. The main difference is that they are about language features rather than something out of the stdlib. :) | |||
| msg334720 -(view) | Author: Raymond Hettinger (rhettinger)*![]() | Date: 2019-02-01 20:39 | |
New changeset85d83ec7c99727476c79feb5c34c65264a99144e by Raymond Hettinger (Amador Pahim) in branch 'master':bpo-35864: fix namedtuple._asdict() docstring (GH-11720)https://github.com/python/cpython/commit/85d83ec7c99727476c79feb5c34c65264a99144e | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:10 | admin | set | github: 80045 |
| 2019-05-02 00:28:22 | rhettinger | set | pull_requests: +pull_request12965 |
| 2019-02-01 20:39:00 | rhettinger | set | messages: +msg334720 |
| 2019-02-01 16:28:26 | eric.snow | set | keywords:patch,patch,patch messages: +msg334697 |
| 2019-02-01 16:25:24 | eric.snow | set | keywords:patch,patch,patch messages: +msg334696 |
| 2019-02-01 16:24:42 | eric.snow | set | keywords:patch,patch,patch messages: +msg334695 |
| 2019-02-01 16:09:09 | eric.snow | set | keywords:patch,patch,patch nosy: +eric.snow messages: +msg334694 |
| 2019-02-01 11:06:04 | python-dev | set | pull_requests: +pull_request11591 |
| 2019-02-01 11:06:01 | python-dev | set | pull_requests: +pull_request11592 |
| 2019-02-01 11:05:57 | python-dev | set | pull_requests: +pull_request11590 |
| 2019-02-01 11:05:53 | python-dev | set | pull_requests: +pull_request11589 |
| 2019-01-31 17:43:18 | rhettinger | set | keywords:patch,patch,patch status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2019-01-31 08:59:54 | rhettinger | set | messages: +msg334617 |
| 2019-01-31 04:25:33 | rhettinger | set | keywords: +patch stage: patch review pull_requests: +pull_request11566 |
| 2019-01-31 04:25:30 | rhettinger | set | keywords: +patch stage: (no value) pull_requests: +pull_request11565 |
| 2019-01-31 04:25:27 | rhettinger | set | keywords: +patch stage: (no value) pull_requests: +pull_request11564 |
| 2019-01-31 02:20:11 | rhettinger | create | |