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


Groups > comp.lang.python > #65153 > unrolled thread

Re: __init__ is the initialiser

Started byEthan Furman <ethan@stoneleaf.us>
First post2014-01-31 16:13 -0800
Last post2014-02-01 05:53 +0000
Articles 9 — 5 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: __init__ is the initialiser Ethan Furman <ethan@stoneleaf.us> - 2014-01-31 16:13 -0800
    Re: __init__ is the initialiser Roy Smith <roy@panix.com> - 2014-01-31 20:10 -0500
      Re: __init__ is the initialiser MRAB <python@mrabarnett.plus.com> - 2014-02-01 01:41 +0000
        Re: __init__ is the initialiser Roy Smith <roy@panix.com> - 2014-01-31 20:53 -0500
      Re: __init__ is the initialiser Ethan Furman <ethan@stoneleaf.us> - 2014-01-31 18:35 -0800
      Dunder [was Re: __init__ is the initialiser] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-01 02:52 +0000
        Re: Dunder [was Re: __init__ is the initialiser] MRAB <python@mrabarnett.plus.com> - 2014-02-01 03:04 +0000
        Re: Dunder [was Re: __init__ is the initialiser] Chris Angelico <rosuav@gmail.com> - 2014-02-01 15:05 +1100
          Re: Dunder [was Re: __init__ is the initialiser] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-01 05:53 +0000

#65153 — Re: __init__ is the initialiser

FromEthan Furman <ethan@stoneleaf.us>
Date2014-01-31 16:13 -0800
SubjectRe: __init__ is the initialiser
Message-ID<mailman.6233.1391214984.18130.python-list@python.org>
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, which is what I think of when speaking of a 
constructor.  I'd be willing to yield the point that Python has a pair of methods that make up the constructor (an 
allocator and an initializer), but I found calling __init__ the constructor very confusing.

--
~Ethan~

[toc] | [next] | [standalone]


#65157

FromRoy Smith <roy@panix.com>
Date2014-01-31 20:10 -0500
Message-ID<roy-EDB0E1.20104631012014@news.panix.com>
In reply to#65153
In article <mailman.6233.1391214984.18130.python-list@python.org>,
 Ethan Furman <ethan@stoneleaf.us> wrote:

> I found calling __init__ the constructor very confusing.

I've heard many people say this, and it's always sort of befuddled me.

In C++, a constructor is really an initializer too.  By the time C++'s 
Foo::Foo() or Python's Foo.__init__() get called, memory has already 
been allocated, so I would say the object has been constructed.  Yet, 
C++ people are perfectly happy calling this "thing that takes some 
allocated hunk of memory and sets its attributes to useful values" a 
constructor[1], and Python people are not.

[1] Well, they really call it a ctor, but I chalk that up to the same 
sort of silliness that makes pythonistas pronounce "__" as "dunder" :-)

[toc] | [prev] | [next] | [standalone]


#65159

FromMRAB <python@mrabarnett.plus.com>
Date2014-02-01 01:41 +0000
Message-ID<mailman.6238.1391218886.18130.python-list@python.org>
In reply to#65157
On 2014-02-01 01:10, Roy Smith wrote:
> In article <mailman.6233.1391214984.18130.python-list@python.org>,
>   Ethan Furman <ethan@stoneleaf.us> wrote:
>
>> I found calling __init__ the constructor very confusing.
>
> I've heard many people say this, and it's always sort of befuddled me.
>
> In C++, a constructor is really an initializer too.  By the time C++'s
> Foo::Foo() or Python's Foo.__init__() get called, memory has already
> been allocated, so I would say the object has been constructed.  Yet,
> C++ people are perfectly happy calling this "thing that takes some
> allocated hunk of memory and sets its attributes to useful values" a
> constructor[1], and Python people are not.
>
You could argue that construction is not complete until the instance
has been initialised. In the case of C++, all you have is the
initialiser, so doesn't really matter, but Python has __new__ and
__init__, so it _does_ matter.

> [1] Well, they really call it a ctor, but I chalk that up to the same
> sort of silliness that makes pythonistas pronounce "__" as "dunder" :-)
>

[toc] | [prev] | [next] | [standalone]


#65162

FromRoy Smith <roy@panix.com>
Date2014-01-31 20:53 -0500
Message-ID<roy-7CBA81.20534231012014@news.panix.com>
In reply to#65159
In article <mailman.6238.1391218886.18130.python-list@python.org>,
 MRAB <python@mrabarnett.plus.com> wrote:

> You could argue that construction is not complete until the instance
> has been initialised. In the case of C++, all you have is the
> initialiser, so doesn't really matter, but Python has __new__ and
> __init__, so it _does_ matter.

C++ has operator new (which you can override) and the constructor.

[toc] | [prev] | [next] | [standalone]


#65166

FromEthan Furman <ethan@stoneleaf.us>
Date2014-01-31 18:35 -0800
Message-ID<mailman.6244.1391222132.18130.python-list@python.org>
In reply to#65157
On 01/31/2014 05:10 PM, Roy Smith wrote:
> In article <mailman.6233.1391214984.18130.python-list@python.org>,
>   Ethan Furman <ethan@stoneleaf.us> wrote:
>
>> I found calling __init__ the constructor very confusing.
>
> I've heard many people say this, and it's always sort of befuddled me.

I have never learned C++, so I don't know its screwy semantics.  ;)

Nor Java, for that matter.

--
~Ethan~

[toc] | [prev] | [next] | [standalone]


#65170 — Dunder [was Re: __init__ is the initialiser]

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2014-02-01 02:52 +0000
SubjectDunder [was Re: __init__ is the initialiser]
Message-ID<52ec6183$0$29972$c3e8da3$5496439d@news.astraweb.com>
In reply to#65157
On Fri, 31 Jan 2014 20:10:46 -0500, Roy Smith wrote:

> In article <mailman.6233.1391214984.18130.python-list@python.org>,
>  Ethan Furman <ethan@stoneleaf.us> wrote:
> 
>> I found calling __init__ the constructor very confusing.
> 
> I've heard many people say this, and it's always sort of befuddled me.
> 
> In C++, a constructor is really an initializer too.  By the time C++'s
> Foo::Foo() or Python's Foo.__init__() get called, memory has already
> been allocated, so I would say the object has been constructed.  Yet,
> C++ people are perfectly happy calling this "thing that takes some
> allocated hunk of memory and sets its attributes to useful values" a
> constructor[1], and Python people are not.
> 
> [1] Well, they really call it a ctor, but I chalk that up to the same
> sort of silliness that makes pythonistas pronounce "__" as "dunder" :-)


I see your smiley, but the comparison is ridiculous.

"Constructor" is three syllables; "ctor" isn't readily pronounceable in 
English at all, rather like Cthulhu. (I can't think of any standard 
English words with a "CT" in them at all, let alone at the start of the 
word). The best I can come up with is "KUH TOR" or possibly "SEE TOR", 
both of which are clumsy, and only save a single syllable.

On the other hand, "double leading and trailing underscore" is ten 
syllables. "Dunder" is two, a significant saving, and it's a readily 
pronounceable word in English (and probably Dutch). There's nothing silly 
about abbreviating "double leading and trailing underscore" as dunder.


-- 
Steven

[toc] | [prev] | [next] | [standalone]


#65174 — Re: Dunder [was Re: __init__ is the initialiser]

FromMRAB <python@mrabarnett.plus.com>
Date2014-02-01 03:04 +0000
SubjectRe: Dunder [was Re: __init__ is the initialiser]
Message-ID<mailman.6250.1391223851.18130.python-list@python.org>
In reply to#65170
On 2014-02-01 02:52, Steven D'Aprano wrote:
> On Fri, 31 Jan 2014 20:10:46 -0500, Roy Smith wrote:
>
>> In article <mailman.6233.1391214984.18130.python-list@python.org>,
>>  Ethan Furman <ethan@stoneleaf.us> wrote:
>>
>>> I found calling __init__ the constructor very confusing.
>>
>> I've heard many people say this, and it's always sort of befuddled me.
>>
>> In C++, a constructor is really an initializer too.  By the time C++'s
>> Foo::Foo() or Python's Foo.__init__() get called, memory has already
>> been allocated, so I would say the object has been constructed.  Yet,
>> C++ people are perfectly happy calling this "thing that takes some
>> allocated hunk of memory and sets its attributes to useful values" a
>> constructor[1], and Python people are not.
>>
>> [1] Well, they really call it a ctor, but I chalk that up to the same
>> sort of silliness that makes pythonistas pronounce "__" as "dunder" :-)
>
>
> I see your smiley, but the comparison is ridiculous.
>
> "Constructor" is three syllables; "ctor" isn't readily pronounceable in
> English at all, rather like Cthulhu. (I can't think of any standard
> English words with a "CT" in them at all, let alone at the start of the
> word). The best I can come up with is "KUH TOR" or possibly "SEE TOR",
> both of which are clumsy, and only save a single syllable.
>
So you've never used the word "ctenoid"? How strange! :-)

(adj. - Resembling a comb; having projections like the teeth of a comb.)

> On the other hand, "double leading and trailing underscore" is ten
> syllables. "Dunder" is two, a significant saving, and it's a readily
> pronounceable word in English (and probably Dutch). There's nothing silly
> about abbreviating "double leading and trailing underscore" as dunder.
>

[toc] | [prev] | [next] | [standalone]


#65188 — Re: Dunder [was Re: __init__ is the initialiser]

FromChris Angelico <rosuav@gmail.com>
Date2014-02-01 15:05 +1100
SubjectRe: Dunder [was Re: __init__ is the initialiser]
Message-ID<mailman.6262.1391232938.18130.python-list@python.org>
In reply to#65170
On Sat, Feb 1, 2014 at 1:52 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> "Constructor" is three syllables; "ctor" isn't readily pronounceable in
> English at all, rather like Cthulhu. (I can't think of any standard
> English words with a "CT" in them at all, let alone at the start of the
> word). The best I can come up with is "KUH TOR" or possibly "SEE TOR",
> both of which are clumsy, and only save a single syllable.

May I tactfully suggest that searching the abstract of a dictionary
for the letters 'ct' would be a useful action here. Actually, you
could collect a compact list of words containing "ct", and maybe even
concoct a paragraph of text that conflicts with the theory that this
is a rare conjunction of characters. Hopefully this will convict you
of the correctness of what I am saying - though it does not at all
deduct from your main point to the effect that few or no English words
would be depicted *starting* with these letters. I mean no disrespect
to you, Steven, but in dissecting your words, I expect myself to
exactly demonstrate the imperfect (I won't say "incorrect", as I don't
have a doctorate in this) information here, to ensure that it does not
infect the structure of python-list. We are all persons of intellect,
and we know how to interact without getting intractable; all I want to
do is offer an introduction to the results of grep|less, not to give a
lecture. I apologize if this comes across harshly, but the neglect of
manners may be a consequence of my nocturnal exertions of late, with
the objective of removing all obstructions to converting to Linux
before I'm an octogenarian. [1] Let us make a pact to view matters
from each other's perspective, as we picture a more practical
projection of life, with a reasonable prospect of rejecting
unpleasantness and resurrecting the on-topic discussions that we might
otherwise have. In retrospect, I perhaps shouldn't have started
writing this, and it may be time to impose sanctions on me for not
being more selective in my use o English; this is becoming a
spectacular flop, a spectre to haunt me. Strictly between ourselves,
wordplay is a subject which (I suspect) is unattractive to many, but
it would be uncharacteristic of me to refrain. I leave the final
verdict up to you: are you the victims of a horrible plot, or will
your vindictive anger be turned aside?

Ahem.

I'd probably pronounce it "k'tor", like your first option but with a
really short schwa in there; or - more likely - I'd spell it "ctor"
and pronounce it "constructor".

ChrisA

[1] Okay, that one's really pushing it.

[toc] | [prev] | [next] | [standalone]


#65201 — Re: Dunder [was Re: __init__ is the initialiser]

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2014-02-01 05:53 +0000
SubjectRe: Dunder [was Re: __init__ is the initialiser]
Message-ID<52ec8bd1$0$29972$c3e8da3$5496439d@news.astraweb.com>
In reply to#65188
On Sat, 01 Feb 2014 15:05:34 +1100, Chris Angelico wrote:

> On Sat, Feb 1, 2014 at 1:52 PM, Steven D'Aprano
> <steve+comp.lang.python@pearwood.info> wrote:
>> "Constructor" is three syllables; "ctor" isn't readily pronounceable in
>> English at all, rather like Cthulhu. (I can't think of any standard
>> English words with a "CT" in them at all, let alone at the start of the
>> word). The best I can come up with is "KUH TOR" or possibly "SEE TOR",
>> both of which are clumsy, and only save a single syllable.
> 
> May I tactfully suggest that searching the abstract of a dictionary for
> the letters 'ct' would be a useful action here.

Point taken :-P

I did say that *I* couldn't think of any. 


-- 
Steven

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web