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 rhettinger
Recipients Dennis Sweeney, danielfleischman, methane, rhettinger, serhiy.storchaka
Date 2021-07-05.20:38:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1625517517.89.0.211165025671.issue44555@roundup.psfhosted.org>
In-reply-to
Content
> I still disagree with this design since it's not 
> how a person using a hash map expects it to behave.

All mapping data structures have tradeoffs.  For the core dict type, we chose a structure that benefits most Python users most of the time.  If a user expects that the core dict type magically handles all cases optimally, that is a bug in their expectation, not a bug in Python.  

For the atypical pattern shown in slow_dictionary(), we recommend choosing a different data structure such as an OrderedDict or simply storing the keys in a deque.  This isn't a blow-off answer -- the stated goal of the collections module is to offer "specialized container datatypes providing alternatives to Python’s general purpose built-in containers, dict, list, set, and tuple."  Those alternatives have different performance characteristics that may better serve particular access patterns.

Thanks for the suggestion, but this is not a bug.  It is an intentional design decision.  Changing the dict implementation to a linked list would make your case perform better but would make most users worse off.
History
Date User Action Args
2021-07-05 20:38:37rhettingersetrecipients: + rhettinger, methane, serhiy.storchaka, Dennis Sweeney, danielfleischman
2021-07-05 20:38:37rhettingersetmessageid: <1625517517.89.0.211165025671.issue44555@roundup.psfhosted.org>
2021-07-05 20:38:37rhettingerlinkissue44555 messages
2021-07-05 20:38:37rhettingercreate