[Python-3000] duck typing
Bill Janssen
janssen at parc.com
Sun May 7 23:24:08 CEST 2006
> A language with the same type system
> as Java, but enforced at run time instead of compile
> time, would be just as annoying to use.
Python already has a different, and in many respects better, type
system than Java has. I'm simply suggesting that the common practice
of ignoring -- or worse, subverting -- the type system, necessary
before the type unification work, be discouraged.
I don't want to ever again use a library that claims to export a
"dict" object, only to find (later) that the implementor hasn't
implemented some of the methods of the real "dict" type because he
thought they wouldn't be called. Or because he was too lazy to
document the interface he'd actually implemented. "Duck typing"
encourages this kind of ramshackle development.
I think that there is little of advantage in the Java type system to
be adopted into Python. One possible addition is the often-discussed
optional type declarations and associated ability to define an
interface for a module or class.
Bill
More information about the Python-3000
mailing list