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


Groups > comp.lang.python > #65175

Re: __init__ is the initialiser

From Terry Reedy <tjreedy@udel.edu>
Subject Re: __init__ is the initialiser
Date 2014-01-31 22:16 -0500
References <lcgtpf$tui$1@ger.gmane.org> <lcgut2$b8r$1@ger.gmane.org> <858utviwgs.fsf@benfinney.id.au> <lchce7$44q$1@ger.gmane.org> <52EC3C40.7080402@stoneleaf.us>
Newsgroups comp.lang.python
Message-ID <mailman.6251.1391224639.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 1/31/2014 7:13 PM, Ethan Furman wrote:
> On 01/31/2014 03:43 PM, Ned Batchelder wrote:
>> On 1/31/14 6:05 PM, Ben Finney wrote:
>>> Ned Batchelder writes:
>>
>> I'm not hoping to change any official terminology. I just think that
>> calling __init__ anything other than a constructor
>> is confusing pedantry.  It is a constructor, and Python constructors
>> work differently than those in C++ and Java.
>
> And I would say the opposite.  __init__ is not creating anything,

As you pointed out in a different response, Python has one default, 
two-phase constructor. type.__call__. Typically, .__new__ allocates a 
generic object (with one customization as to class). .__init__ creates, 
from that mostly generic object, a customized instance of class C with 
the minimal attributes needed to be an instance of C, with value 
specific to the instance.

Creating a painting on canvas has two similar phases. Prepare a generic 
blank canvas stretched on a frame and coated with a white undercoat. 
Paint a particular picture. Would you say that the second step is not 
creating anything?

-- 
Terry Jan Reedy

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


Thread

Re: __init__ is the initialiser Terry Reedy <tjreedy@udel.edu> - 2014-01-31 22:16 -0500
  Re: __init__ is the initialiser Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-01 05:23 +0000
    Re: __init__ is the initialiser Roy Smith <roy@panix.com> - 2014-02-01 00:25 -0500
      Re: __init__ is the initialiser Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-02-03 12:15 +1300
        Re: __init__ is the initialiser Chris Angelico <rosuav@gmail.com> - 2014-02-03 10:27 +1100
          Re: __init__ is the initialiser Roy Smith <roy@panix.com> - 2014-02-02 18:40 -0500
            Re: __init__ is the initialiser Chris Angelico <rosuav@gmail.com> - 2014-02-03 11:07 +1100
            Re: __init__ is the initialiser Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-02-02 17:24 -0800
            Re: __init__ is the initialiser Chris Angelico <rosuav@gmail.com> - 2014-02-03 12:37 +1100
            Re: __init__ is the initialiser Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-02-02 17:54 -0800
            Re: __init__ is the initialiser Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-02-03 08:44 -0500
            Re: __init__ is the initialiser Nicholas Cole <nicholas.cole@gmail.com> - 2014-02-03 13:50 +0000
            Re: __init__ is the initialiser Ian Kelly <ian.g.kelly@gmail.com> - 2014-02-03 10:44 -0700
            Re: __init__ is the initialiser Chris Angelico <rosuav@gmail.com> - 2014-02-04 04:57 +1100
            Re: __init__ is the initialiser Nicholas Cole <nicholas.cole@gmail.com> - 2014-02-03 19:57 +0000
            Re: __init__ is the initialiser Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-02-03 19:38 -0500
        Re: __init__ is the initialiser Dave Angel <davea@davea.name> - 2014-02-02 19:35 -0500
          Re: __init__ is the initialiser Roy Smith <roy@panix.com> - 2014-02-02 19:45 -0500
            Re: __init__ is the initialiser Dave Angel <davea@davea.name> - 2014-02-02 22:14 -0500
            Re: __init__ is the initialiser Skip Montanaro <skip@pobox.com> - 2014-02-02 21:15 -0600
            Re: __init__ is the initialiser Dave Angel <davea@davea.name> - 2014-02-03 00:06 -0500
              Re: __init__ is the initialiser Roy Smith <roy@panix.com> - 2014-02-03 00:12 -0500
                Re: __init__ is the initialiser Chris Angelico <rosuav@gmail.com> - 2014-02-03 16:49 +1100
                Re: __init__ is the initialiser Ethan Furman <ethan@stoneleaf.us> - 2014-02-02 21:34 -0800
    Re: __init__ is the initialiser Rustom Mody <rustompmody@gmail.com> - 2014-01-31 21:31 -0800

csiph-web