This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add a pure Python version of 'collections.defaultdict'
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.6
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: abarry, rhettinger
Priority: low Keywords: patch

Created on 2016-06-04 17:07 by abarry, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
py_defaultdict_1.patch abarry, 2016-06-04 17:07 review
Messages (5)
msg267276 - (view) Author: Anilyka Barry (abarry) * (Python triager) Date: 2016-06-04 17:07
Attached patch adds a pure Python version of `collections.defaultdict`. This is yet another step in providing better support for alternate implementations, which may or may not have `_collections`.

I also went ahead and fixed __all__ so that `from collections import *` doesn't fail if 'deque' isn't present (which it may not be in alternate implementations).

Patch includes (small) doc and test changes. All tests pass successfully for both versions.
msg269905 - (view) Author: Anilyka Barry (abarry) * (Python triager) Date: 2016-07-06 19:33
Raymond, do you have any interest/time to review this? I can ask someone else, if you prefer.
msg269959 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2016-07-07 21:52
I don't think there is any advantage to adding a pure python version of defaultdict (or we would have done it a long time ago).   Each time we do this, it creates a host of downstream issues where people notice minor implementation differences between the two.
msg269960 - (view) Author: Anilyka Barry (abarry) * (Python triager) Date: 2016-07-07 22:03
I agree that CPython itself gains nothing from having this, as this is so that alternate implementations have it as well. I get what you mean about the minor differences, however I think it's a good thing, as it helps to make sure the tests are precise enough so that there can't be any differences (but that's probably just me).
msg269961 - (view) Author: Anilyka Barry (abarry) * (Python triager) Date: 2016-07-07 22:13
(Also, if this is going to be rejected still, I think that fixing __all__ to only conditionally add 'deque' and 'defaultdict' should be considered)
History
Date User Action Args
2022-04-11 14:58:32adminsetgithub: 71407
2016-07-07 22:13:05abarrysetmessages: + msg269961
2016-07-07 22:03:57abarrysetmessages: + msg269960
2016-07-07 21:52:50rhettingersetpriority: normal -> low
status: open -> closed
resolution: rejected
messages: + msg269959
2016-07-07 04:28:29serhiy.storchakasetassignee: rhettinger
2016-07-06 19:33:57abarrysetmessages: + msg269905
2016-06-04 17:07:44abarrycreate