__init__ explanation please
Steven D'Aprano
steven at REMOVE.THIS.cybersource.com.au
Mon Jan 14 22:44:25 EST 2008
On Tue, 15 Jan 2008 00:00:45 +0100, Hrvoje Niksic wrote:
> Ben Finney <bignose+hates-spam at benfinney.id.au> writes:
>
>> Hrvoje Niksic <hniksic at xemacs.org> writes:
>>
>>> Wildemar Wildenburger <lasses_weil at klapptsowieso.net> writes:
>>> > __init__() /initializes/ an instance (automatically after creation).
>>> > It is called, /after/ the instance has been constructed
>>>
>>> I don't understand the purpose of this "correction". After all,
>>> __init__ *is* the closest equivalent to what other languages would
>>> call a constructor.
>>
>> No. That would be '__new__', which actually constructs the instance,
>
> That's not what other OO languages (C++, Java) actually call a
> constructor, so your correction is misplaced. My other posts in this
> thread have expanded on this.
How fortunate that Python isn't one of those other OO languages,
otherwise it might cause a bit of confusion.
--
Steven
More information about the Python-list
mailing list