"Super()" confusion

Chris Rebert clp2 at rebertia.com
Tue Feb 10 01:25:49 CET 2009

On Mon, Feb 9, 2009 at 4:18 PM, Lionel <lionel.keene at gmail.com> wrote:
> On Feb 9, 4:04 pm, Jean-Paul Calderone <exar... at divmod.com> wrote:
>> On Mon, 9 Feb 2009 15:20:05 -0800 (PST), Lionel <lionel.ke... at gmail.com> wrote:
>> >Hello. I've been scouring the web looking for something to clear up a
>> >little confusion about the use of "super()" but haven't found anything
>> >that really helps. Here's my simple example:
>> > [snip]
>> >"super(Child,self).__init__(filePath)
>> >TypeError: super() argument 1 must be type, not classobj"
>> >What have I done wrong? Thanks in advance for any help.
>> Consider whether you really need to use super().
>> http://fuhm.net/super-harmful/
>> Jean-Paul
> Yes, I came across that essay...and it scared me. Will my base class
> initializer always get called regardless of whether or not I use super
> ()?

No, it is not called unless you /explicitly/ call it (either using
super() or manually via BaseClassName.__init__(self, other, args,
here)) in your subclass' __init__ or you don't define an __init__ for
your subclass (and it inherits __init__ from its first superclass).


Follow the path of the Iguana...

More information about the Python-list mailing list