python - How to invoke the super constructor? -


class a:  def __init__(self):    print "world"  class b(a):  def __init__(self):    print "hello"  b() hello 

in other languages i've worked super constructor invoked implicitly. how 1 invoke in python? expect super(self) doesn't work.

super() returns parent-like object in new-style classes:

class a(object):     def __init__(self):         print "world"  class b(a):     def __init__(self):         print "hello"         super(b, self).__init__()  b() 

Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

python - malformed header from script index.py Bad header -