Inconsistency between dict() and collections.OrderedDict() methods.
python at lucidity.plus.com
Sat Apr 29 19:22:58 EDT 2017
On 29/04/17 23:40, Ned Batchelder wrote:
> For creating your own class that acts like
> a dict, you should derive from collections.abc.MutableMapping, which
> only requires implementing __getitem__, __setitem__, __delitem__,
> __iter__, and __len__.
Or, I could derive from collections.OrderedDict and just implement the
two methods that I actually want to change the behavior of (did you read
the rest of my post?) ;)
That's one of the points I'm trying to make - why is it harder than it
needs to be to do something this simple?
The other is that the documentation of collections.OrderedDict seems to
be lacking (it is talking in terms of being a "dict" subclass, but it
actually isn't one).
More information about the Python-list