Mega Code Archive

 
Categories / Python Tutorial / Class
 

__init__() is not invoked automatically when the subclass is instantiated

class P(object):     def __init__(self):         print "calling P's constructor" class C(P):     def __init__(self):         print "calling C's constructor" c = C()