[Tutor] constructors
Sean 'Shaleh' Perry
shalehperry@attbi.com
Tue, 09 Apr 2002 22:50:24 -0700 (PDT)
>
> I say use a ctor (called __init__ in python) if you need/want to
> initialize the members of the object to some value when it is created.
> If you don't need/want that, then don't bother writing an empty one.
> I have found that most of the time you do want a ctor (though that
> may be my C++/Java background there). You can use default arguments
> to allow for variations in usage. For example :
>
there are many times when there is no way to define a default version of an
object, so having a constructor makes sense. This is especially true when you
are modelling the real world or your objects represent items.