[Python-Dev] defaultdict proposal round three
Greg Ewing
greg.ewing at canterbury.ac.nz
Tue Feb 21 10:50:17 CET 2006
Delaney, Timothy (Tim) wrote:
> However, *because* Python uses duck typing, I tend to feel that
> subclasses in Python *should* be drop-in replacements.
Duck-typing means that the only reliable way to
assess whether two types are sufficiently compatible
for some purpose is to consult the documentation --
you can't just look at the base class list.
I think this should work both ways. It should be
okay to *not* document autodict as being a subclass
of dict, even if it happens to be implemented that
way.
I've adopted a convention like this in PyGUI,
where I document the classes in terms of a
conceptual interface hierarchy, without promising
that they will be implemented that way.
Greg
More information about the Python-Dev
mailing list