__init__ like in java

Steve Holden sholden at holdenweb.com
Fri Dec 22 18:26:08 CET 2000


Gilles Lenfant <glenfant at equod.com.nospam> wrote in message
news:91vosi$19h$1 at reader1.imaginet.fr...
> Hi,
>
> Is there an *elegant pythonic*  way to have several constructors for one
> class ?
>
> TIA
>
>
If you mean constructor function overloading according to the call
signature, as is possible in Java and C++, then I'm afraid the answer has to
be "no".  This would have to be programmed inside the __init__() function,
as the Python language does not allow such overloading: only one definition
of a method with a given name can exist in a class definition.

regards
 Steve







More information about the Python-list mailing list