Multiple initialization methods?

alex alexander.dietz at mpi-hd.mpg.de
Wed Feb 16 16:31:31 EST 2005


Hi,

it is possible to define multiple initialization methods so that the
method is used that fits?

I am thinking of something like this:

  def __init__(self, par1, par2):
    self.init(par1, par2);

  def __init__(self, par1):
    self.init(par1, None)

  def init(self, par1, par2):
     ...
     ...

So if the call is with one parameter only the second class is executed
(calling the 'init' method with the second parameter set to 'None' or
whatever. But this example does not work. 

How to get it work?

Alex




More information about the Python-list mailing list