super with only one argument

Michele Simionato michele.simionato at gmail.com
Tue Mar 15 04:37:59 CET 2005


No, you should use the version with two arguments for that.
The second argument would be a class however, not an instance.
Example:

class C(object):
    @staticmethod
    def f():
        print "C.f"

class D(C):
    @staticmethod
    def f():
        print "D.f"
        super(D, D).f()

D.f()

Just using super(D).f() would not work. ``super`` with only one
argument is
a recipe for headaches.

              Michele Simionato




More information about the Python-list mailing list