Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.031 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'value,': 0.04; 'argument': 0.05; 'none,': 0.07; 'method,': 0.09; 'subject:design': 0.09; 'exclamation': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'sharp': 0.16; 'subject:Language': 0.16; 'language': 0.16; 'wrote:': 0.18; 'do.': 0.18; 'thu,': 0.19; '>>>': 0.22; '(in': 0.22; 'case.': 0.24; 'stopping': 0.24; '(or': 0.24; 'primary': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'feature': 0.29; 'am,': 0.29; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; '(which': 0.31; '13,': 0.31; 'accidentally': 0.31; 'sep': 0.31; 'fri,': 0.33; 'received:google.com': 0.35; 'doing': 0.36; "didn't": 0.36; 'method': 0.36; 'possible': 0.36; 'behind': 0.37; 'list.': 0.37; 'to:addr:python-list': 0.38; '12,': 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'chain': 0.60; 'free': 0.61; 'new': 0.61; 'more': 0.64; 'side': 0.67; 'between': 0.67; 'policy.': 0.68; 'default': 0.69; 'touch': 0.74; 'demand': 0.91; 'habit': 0.91; 'reasoning': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=/OR4kX0U1Wk5QUXPIKRL2b9sl2H2TXotSByiz8oHfwo=; b=VJlO+7s+2Rn4huP9Ci1onmoe+yPpocjMZtoLjLxsyad468lHpbhdEvCo6Tdn5e/np0 X0QET8dkvAy783dFJiZYB70yVdbzXgtwS/9rgS4S5DXdH0XuLFVJv+iVZTFb6Mgdta2E G/zyO6zT6HRFZynTi44bz56SypBp0sAS8oOVUfYQM+AmNK/ag1pAUl4XanEAFXfOvfle aiAmawmgPxwqUrovuiayg2YuGHdmMyU9eooJP310uN+ezA7Tn6Cfa0Ky3fYih6gFZWQv kcPUwnxVd8O4CMweDKv5tsI3nyCFTESR3FIPx7fk9Z5tX6yBhCUKSOhYw0GZA8yBbpE0 0lbQ== MIME-Version: 1.0 X-Received: by 10.220.164.70 with SMTP id d6mr8416138vcy.19.1379022819181; Thu, 12 Sep 2013 14:53:39 -0700 (PDT) In-Reply-To: <5232042C.3020700@markusrother.de> References: <522eb795$0$29999$c3e8da3$5496439d@news.astraweb.com> <5230D58E.9020508@markusrother.de> <5232042C.3020700@markusrother.de> Date: Fri, 13 Sep 2013 07:53:39 +1000 Subject: Re: Language design From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1379022827 news.xs4all.nl 15918 [2001:888:2000:d::a6]:51697 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:54086 On Fri, Sep 13, 2013 at 4:13 AM, Markus Rother wrote: > On 12.09.2013 01:27, Chris Angelico wrote: >> On Thu, Sep 12, 2013 at 6:41 AM, Markus Rother wrote: >>> 3. The default return value of methods is None instead of self. >>> If it was self, it would be possible to chain method calls (which >>> is called a cascade in smalltalk). >> >> That's a policy decision: a method (or function) will *EITHER* return >> a value, *OR* mutate its primary argument (in the case of a method, >> that's self). > > You are stating: "All getters must be free of side effects". > That is not the case. Furthermore, the demand for getters with hidden > side effects is the reasoning behind properties. This isn't a language feature here, just a stdlib policy. It's more akin to Ruby's habit of adorning the mutating methods with an exclamation mark - it's a way of stopping you from accidentally doing what you didn't mean to do. There's a sharp distinction between list.sort(), which mutates in place and returns None, and sorted(), which doesn't touch its argument and returns a new list. ChrisA