[Tutor] How many types of the constructor

spir denis.spir at free.fr
Mon Apr 27 19:55:38 CEST 2009


Le Mon, 27 Apr 2009 22:38:30 +0530,
sudhanshu gautam <sudhanshu9252 at gmail.com> s'exprima ainsi:


> Now If I placed the name of the constructor rather than the __init__
> __baba___ so will it also work as a constructor or constructor has specified
> already if yes then give me list of them

Actually __init__ is not the constructor, which is __new__ (much less used), but the initialiser. If you try to do their work using other names, it may not work as expected because python does some magic in the background. Still, if you really know what you're doing it's possible for some of these special methods, while not for __new__ I guess. Anyway, it's maybe a bad idea cause conventional names help and understand the code.

> ragards
> sudhanshu

Denis
------
la vita e estrany


More information about the Tutor mailing list