how to use more than 1 __init__ constructor in a class ?
steve at REMOVETHIScyber.com.au
Thu Jun 23 03:25:59 CEST 2005
On Wed, 22 Jun 2005 12:34:21 -0500, Rocco Moretti wrote:
> scott wrote:
>> hi people,
>> can someone tell me, how to use a class like that* (or "simulate" more
>> than 1 constructor) :
> You could also turn __init__ into a dispatch fuction:
> class myPointClass:
> def __init__(self, *args):
> if len(args) <= 2:
> if len(args) == 3:
Oh wow, so that's what I've been doing for years. Dispatching.
And I thought I was just calling other functions :-)
That's the joys of a mostly self-taught programming knowledge: you miss
out on all the buzzwords.
More information about the Python-list