On 8/1/07, Evan Klitzke <[EMAIL PROTECTED]> wrote:
> Hi list,
>
> I was reading this article: http://fuhm.net/super-harmful/ and didn't
> understand the comment about calling super(Foo, self).__init__() when
> Foo inherits only from object. Can someone on the list elaborate more
> on why one should do this?

I hate to reply to my own thread, but I read this article:
http://www.python.org/download/releases/2.3/mro/ and I think I
understand the rationale now. If you have:

class Foo(object):
    # stuff here
class Bar(object):
    # stuff here
class Baz(Foo, Bar):
    # stuff here

Then if Baz calls super(Baz, self).__init__() in its __init__, and Foo
makes no call super(Foo, self).__init__(), then the constructor for
Bar will never be called.

-- 
Evan Klitzke <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to