how to use more than 1 __init__ constructor in a class ?

scott scott at alussinan.org
Wed Jun 22 13:18:23 EDT 2005


hi people,

can someone tell me, how to use a class like that* (or "simulate" more 
than 1 constructor) :
#--
class myPointClass:
   def __init__(self, x=0, y=0):
     self.x = x
     self.y = y
   def __init__(self, x=0, y=0, z=0):
     self.__init__(self, x, y)
     self.z = z
#--

tia people
scott

*this is not homework



More information about the Python-list mailing list