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.

Author danielfleischman
Recipients Dennis Sweeney, danielfleischman, methane, rhettinger, serhiy.storchaka
Date 2021-07-03.17:25:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1625333123.6.0.395883377405.issue44555@roundup.psfhosted.org>
In-reply-to
Content
Thank you again, Dennis.

I would disagree with your conclusion for mainly 3 reasons:

1. The linked list proposal would increase the memory usage by 2 Py_ssize_t per entry, plus another 2 for the whole dictionary. I don't think this is an overwhelming amount of extra memory for Python, but of course it's open for discussion. Insertions and removals would become marginally slower (I'll try to measure it), membership wouldn't suffer, and iteration would become O(1) per element iterated on. 

2. I think that this case is covered by "Dynamic Mappings" in the document you've linked to.

3. This is not about the ordering in ducts being first or second nature. Please read the example in bad_dict_example.py to see a bad case where hearing over a dict of size 1 can take milliseconds.

I want to reiterate (pun not intended) that this is not a use case for me, but it surprised me that dictionaries display this behavior. It's not hard to imagine a real use case where it just happens that someone deletes elements from a dictionary in insertion order. Or that someone deletes all keys but the last inserted (in any order), resulting in a dictionary that takes way too long to iterate on. 


Thank you for the discussion. :)
History
Date User Action Args
2021-07-03 17:25:23danielfleischmansetrecipients: + danielfleischman, rhettinger, methane, serhiy.storchaka, Dennis Sweeney
2021-07-03 17:25:23danielfleischmansetmessageid: <1625333123.6.0.395883377405.issue44555@roundup.psfhosted.org>
2021-07-03 17:25:23danielfleischmanlinkissue44555 messages
2021-07-03 17:25:23danielfleischmancreate