Calling __init__ with multiple inheritance

Axel Straschil axel at straschil.com
Mon Mar 28 07:51:12 EST 2005


Hello!

Im working with new (object) classes and normaly call init of ther
motherclass with callin super(...), workes fine.

No, I've got a case with multiple inherance and want to ask if this is
the right and common case to call init:

class Mother(object):
	def __init__(self, param_mother): print 'Mother'
class Father(object):
	def __init__(self, param_father): print 'Father'
class Child(Mother, Father):
	def __init__(self, param_mother, param_father): 
		Mother.__init__(self, param_mother)
		Father.__init__(self, param_mother)
child = Child(1, 2)

Thanks, AXEL.



More information about the Python-list mailing list