Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'mrab': 0.05; 'tom': 0.07; '__init__': 0.09; 'constructor': 0.09; 'exit': 0.09; 'sentence': 0.09; '>on': 0.16; '>the': 0.16; '__new__': 0.16; 'created.': 0.16; 'creation.': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'initializes': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'received:211.29': 0.16; 'received:211.29.132': 0.16; 'received:cskk.homeip.net': 0.16; 'received:homeip.net': 0.16; 'received:optusnet.com.au': 0.16; 'received:syd.optusnet.com.au': 0.16; 'simpson': 0.16; 'succinct': 0.16; ':-)': 0.16; 'ignore': 0.16; 'wrote:': 0.18; 'seems': 0.21; 'separate': 0.22; 'header :User-Agent:1': 0.23; 'basis,': 0.24; 'earlier': 0.24; 'cheers,': 0.24; 'header:In-Reply-To:1': 0.27; 'getting': 0.31; 'post.': 0.31; 'comment': 0.34; 'subject:the': 0.34; "can't": 0.35; 'point.': 0.35; 'there': 0.35; 'explains': 0.36; 'received:com.au': 0.36; 'charset:us-ascii': 0.36; 'clear': 0.37; 'received:211': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'previous': 0.38; 'to:addr:python.org': 0.39; 'called': 0.40; 'new': 0.61; 'simple': 0.61; 'content-disposition:inline': 0.62; 'line,': 0.68; 'batchelder': 0.84; 'ethan': 0.84; 'furman': 0.84; 'step.': 0.91; 'choice.': 0.93 Date: Sat, 1 Feb 2014 09:45:07 +1100 From: Cameron Simpson To: python-list@python.org Subject: Re: __init__ is the initialiser MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <52EC0E3C.5070900@stoneleaf.us> User-Agent: Mutt/1.5.21 (2010-09-15) References: <52EC0E3C.5070900@stoneleaf.us> X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=HZAtEE08 c=1 sm=1 tr=0 a=YuQlxtEQCowy2cfE5kc7TA==:117 a=YuQlxtEQCowy2cfE5kc7TA==:17 a=ZtCCktOnAAAA:8 a=PO7r1zJSAAAA:8 a=LcaDllckn3IA:10 a=kj9zAlcOel0A:10 a=vrnE16BAAAAA:8 a=8AHkEIZyAAAA:8 a=1U9r9e_U-9MA:10 a=dbnN3sn1AAAA:8 a=ESNNAlkxdC4Sx_AuwHMA:9 a=CjuIK1q_8ugA:10 a=ExiFL-q3zkAA:10 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 33 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391208314 news.xs4all.nl 2933 [2001:888:2000:d::a6]:33489 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65146 On 31Jan2014 12:57, 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. On this basis, would it suffice to change the opening sentence from: Called when the instance is created. to Called to initialise a new instance immediately after creation. ? This seems succinct while getting both "initialise" and "new" into the line, which makes it clear that there is a separate and earlier "new" step. (Conveniently overridable with __new__ :-) Cheers, -- Cameron Simpson Don't have awk? Use this simple sh emulation: #!/bin/sh echo 'Awk bailing out!' >&2 exit 2 - Tom Horsley