Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #65163

Re: __init__ is the initialiser

From Ben Finney <ben+python@benfinney.id.au>
Subject Re: __init__ is the initialiser
Date 2014-02-01 13:10 +1100
References <52EC0E3C.5070900@stoneleaf.us> <20140131224507.GA5454@cskk.homeip.net> <85ob2rhfxd.fsf@benfinney.id.au> <52EC3C14.8080806@stoneleaf.us>
Newsgroups comp.lang.python
Message-ID <mailman.6241.1391220636.18130.python-list@python.org> (permalink)

Show all headers | View raw


Ethan Furman <ethan@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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: __init__ is the initialiser Ben Finney <ben+python@benfinney.id.au> - 2014-02-01 13:10 +1100

csiph-web