[Python-Dev] defaultdict proposal round three

Guido van Rossum guido at python.org
Tue Feb 21 00:17:56 CET 2006

On 2/20/06, Brett Cannon <brett at python.org> wrote:
> While #3 is my preferred solution as well, it does pose a Liskov
> violation if this is a direct dict subclass instead of storing a dict
> internally (can't remember the name of the design pattern that does
> this).  But I think it is good to have the constructor be different
> since it does also help drive home the point that this is not a
> standard dict.

I've heard this argument a few times now from different folks and I'm
tired of it. It's wrong. It's not true. It's a dead argument. It's
pushing up the daisies, so to speak.

Please stop abusing Barbara Liskov's name and remember that the
constructor signature is *not* part of the interface to an instance!
Changing the constructor signature in a subclass does *not* cause
*any* "Liskov" violations because the constructor is not called by
*users* of the object -- it is only called to *create* an object. As
the *user* of an object you're not allowed to *create* another
instance (unless the object provides an explicit API to do so, of
course, in which case you deal with that API's signature, not with the

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-Dev mailing list