How can I call a subclass method from parent class ?

bonono at bonono at
Thu Oct 20 05:55:40 CEST 2005


Suppose my class definition is like this :

class A:
    name = "A"

    def foo(cls):

    def bar(cls):

class B(A):
    name = "B"

class C(B):
    name = "C"

What I want is prints 'ABC' prints 'BC' prints 'A'

But when I call, it said

AttributeError: class C has no attribute '_A__super'

How should this be coded ?

More information about the Python-list mailing list