style question: anything wrong with super(type(self), self).f() ?

Adam Monsen haircut at gmail.com
Mon Sep 19 17:53:25 CEST 2005


Is there anything wrong with using something like super(type(self),
self).f() to avoid having to hardcode a type? For example:

class A(object):
    def f(self):
        print "in A.f()"

class B(A):
    def f(self):
        super(type(self), self).f()

obj = A()
obj.f() # prints "in A.f()"


By "wrong" I mean, is there any reason why this is just a Bad Idea?
Seems helpful to me, if I change the name of the 'B' class, I don't
have to change super() calls as well.

--
Adam Monsen
http://adammonsen.com/




More information about the Python-list mailing list