__init__ is the initialiser

Ben Finney ben+python at benfinney.id.au
Sat Feb 1 03:10:21 CET 2014


Ethan Furman <ethan at stoneleaf.us> writes:

> On 01/31/2014 03:47 PM, Ben Finney wrote:
> > 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].

My apologies, you're right and that's made clear at
<URL:file:///usr/share/doc/python3.3/html/reference/datamodel.html#object.__new__>.

Try:

    object.__init__(self[, …])
        Called automatically after the constructor “__new__”, during
        instance creation, to initialise the new instance.

-- 
 \      “Software patents provide one more means of controlling access |
  `\      to information. They are the tool of choice for the internet |
_o__)                                     highwayman.” —Anthony Taylor |
Ben Finney




More information about the Python-list mailing list