[Python-Dev] python and super

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Apr 15 03:39:09 CEST 2011


Raymond Hettinger wrote:

> If an external non-cooperative class needs to be used, then
> it should be wrapped in a class that makes an explicit
> __init__ call to the external class and then calls super().__init__()
> to continue the forwarding.

I don't think it's as simple as that. Isn't that super() call
going to call the __init__() method that you just explicitly
called *again*?

Seems like you would at least need to use super(BaseClass)...
to skip the one you just called. But it's not immediately
obvious to me that this won't ever skip other classes that
you *do* want to call.

-- 
Greg


More information about the Python-Dev mailing list