Multiple initialization methods?
Steven Bethard
steven.bethard at gmail.com
Wed Feb 16 16:54:12 EST 2005
alex wrote:
> 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.
Why don't you just write this as:
def __init__(self, par1, par2=None):
self.init(par1, par2)
STeVe
More information about the Python-list
mailing list