[Python-ideas] OrderedCounter and OrderedDefaultDict
Random832
random832 at fastmail.com
Wed Oct 21 04:58:32 CEST 2015
Chris Angelico <rosuav at gmail.com> writes:
> On Wed, Oct 21, 2015 at 8:56 AM, Carl Meyer <carl at oddbird.net> wrote:
> Sure, but a dictionary with a default handler _is_ a form of
> specialization - as is a dictionary that preserves order. Both of them
> behave absolutely identically to a regular dict when you set
> something, retrieve it, iterate over them, etc, etc, etc. She
> recommends a massive superclass that's capable of any form of
> injection; using inheritance allows the dict type to be broadly
> unaware of the modified dictionaries that exist.
Even considering that OrderedDict (or a _proper_ SortedDict - other
languages' equivalent class doesn't require hashable keys because it
stores items as a sorted list) requires a complete overhaul of how the
dictionary stores items?
Really, from an implementation standpoint, it seems like a bad idea to
even inherit in this case.
More information about the Python-ideas
mailing list