[Tutor] __init__() - is it required?
Alan Gauld
alan.gauld at btinternet.com
Mon Jan 10 10:03:50 CET 2011
"bob gailer" <bgailer at gmail.com> wrote
>> No, init() is only for initialising the object instance.
>> If you have no local instance spwecific initialisation
>> you can leave it to the inherited init() aor have no init()
>> at all.
>
> Well I'd like to expand that a bit. There are cases where I create a
> class attribute and update it each time an instance is created. O
Good point.
init() can legitimately do things other than initialising instance
variables, but conceptually those things are all part of initialising
an instance. Updating class variables is a good example of
such "other things".
Alan G.
More information about the Tutor
mailing list