[Python-Dev] PEP 372 -- Adding an ordered directory to collectionsready for pronouncement

"Martin v. Löwis" martin at v.loewis.de
Mon Mar 2 21:08:44 CET 2009

> This strict interpretation is violated all the time in OO programming;
> consider e.g. the common overriding of object.__repr__. (In fact, even
> the definition of dict.__eq__ overriding object.__eq__ would validate
> it.) AFAIK a more common use of the term in OO languages is about
> signatures only:

Slightly off-topic: I think what matters in reality is a
difficult-to-formulate *specification* of the behavior of the operation
also. I.e. not /all/ provable properties of the base implementation
need to be maintained, but only those occurring in the specification
of the base operation. Applications using the base then can only rely
on the *specified* properties of the operations they use, and there you
get substitutability.

Of course, what properties are part of the specification is an ongoing
discussion for many class hierarchies, in many languages (see e.g. the
relationship between __eq__ and __hash__).

Beyond transitivity and consistency with __hash__ (which is irrelevant
here), I don't think odict.__eq__ should be restricted to behave the
same as dict.__eq__.


More information about the Python-Dev mailing list