[Python-Dev] defaultdict proposal round three
fuzzyman at voidspace.org.uk
Tue Feb 21 11:17:52 CET 2006
Greg Ewing wrote:
>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.
What's the API for that ?
I've had problems in code that needs to treat strings, lists and
dictionaries differently (assigning values to a container where all
three need different handling) and telling the difference but allowing
duck typing is *problematic*.
More information about the Python-Dev