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


Groups > comp.lang.python > #65145

Re: __init__ is the initialiser

From Ned Batchelder <ned@nedbatchelder.com>
Subject Re: __init__ is the initialiser
Date 2014-01-31 17:44 -0500
References <lcgtpf$tui$1@ger.gmane.org> <lcgut2$b8r$1@ger.gmane.org> <52EC0C0A.7010508@mrabarnett.plus.com> <52EC0E3C.5070900@stoneleaf.us>
Newsgroups comp.lang.python
Message-ID <mailman.6225.1391208282.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 1/31/14 3:57 PM, Ethan Furman wrote:
> On 01/31/2014 12:48 PM, MRAB wrote:
>> On 2014-01-31 19:52, Ned Batchelder wrote:
>>>
>>> Why can't we call __init__ the constructor and __new__ the allocator?
>>
>> The advantage of calling it the "initialiser" is that it explains why
>> it's called "__init__".
>
> Hm, yes, good point.  Also, __init__ initializes so it is a good
> choice.   Ignore the names comment in my previous post.

These days, when teaching Python, I'd say, "__init__ is an initializer, 
or constructor."

-- 
Ned Batchelder, http://nedbatchelder.com

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


Thread

Re: __init__ is the initialiser Ned Batchelder <ned@nedbatchelder.com> - 2014-01-31 17:44 -0500

csiph-web