[Python-Dev] defaultdict proposal round three

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Feb 21 01:00:32 CET 2006


Brett Cannon wrote:

> While #3 is my preferred solution as well, it does pose a Liskov
> violation if this is a direct dict subclass

I'm not sure we should be too worried about that.
Inheritance in Python has always been more about
implementation than interface, so Liskov doesn't
really apply in the same way it does in statically
typed languages.

In other words, just because A inherits from B in
Python isn't meant to imply that an A is a drop-in
replacement for a B.

Greg


More information about the Python-Dev mailing list