__init__ is the initialiser

Ethan Furman ethan at stoneleaf.us
Sat Feb 1 01:13:08 CET 2014


On 01/31/2014 03:47 PM, Ben Finney wrote:
>
> I would prefer it to be clear that “__init__” is called automatically,
> *during* the constructor's operation. So, instead of:
>
>      Called when the instance is created.
>
> I suggest:
>
>      Called automatically by the constructor “__new__” during instance
>      creation, to initialise the new instance.

But __new__ does not call __init__, type does [1].

--
~Ethan~

[1] And I seem to think pickle does, too, but I'm not sure.



More information about the Python-list mailing list