[Python-Dev] Duck-typing self

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Feb 19 02:39:07 CET 2009


Sebastian Rittau wrote:

> Is it a design decision that duck-typing self does not work or is there a
> technical reason?

There's no technical reason as far as user-defined
classes are concerned. I think it was introduced to
help catch errors due to making inherited method
calls to the wrong class, which can easily happen
if you change the base class of a class and forget
to update all of the inherited calls to match.

I believe this type check has been removed in 3.0,
so duck-typing of self is possible there.

-- 
Greg


More information about the Python-Dev mailing list