super() and type()

Chris Mellon arkanes at gmail.com
Mon Nov 27 13:53:24 EST 2006


I see super documented, and in use, as below (from the Python documentation)

class C(B):
    def meth(self, arg):
        super(C, self).meth(arg)

I'd like to not write C all the time, so is there any problem with writing:

class C(B):
    def meth(self, arg):
        super(type(self), self).meth(arg)


This seems to work in practice but I don't see it used anywhere and
I'm worried what I might be missing.

This was especially brought to my attention because pylint flags the
second usage as invalid, and I'm not sure if it should be considered a
false positive or not.



More information about the Python-list mailing list