[docs] [issue24721] The result of calling dict.* methods on OrderedDict is undefined.

Mark Shannon report at bugs.python.org
Sun Jul 26 12:41:18 CEST 2015


Mark Shannon added the comment:

I think this is a bug. This is not a normal case of subclassing as the interpreter calls the C API PyDict_XXX() in many cases where a dictionary subclass is passed in.

For example:
class C: pass
c = C()
# Liskov substitution principle says this is OK.
c.__dict__ = OrderedDict() 
c.a = 1

All access to the ordered dict is via the dict.__setitem__ method.

I think this should be documented.

----------
nosy: +Mark.Shannon

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24721>
_______________________________________


More information about the docs mailing list