On Sunday, April 30, 2017 at 12:23:19 AM UTC+1, Erik wrote: > 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). > > E.
Could have fooled me. C:\python Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from collections import OrderedDict >>> o = OrderedDict() >>> isinstance(o, dict) True Kindest regards. Mark Lawrence. -- https://mail.python.org/mailman/listinfo/python-list