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


Groups > comp.lang.python > #56222

Re: feature requests

Path csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'beginner': 0.05; 'guido': 0.05; 'skip:` 10': 0.07; "'return": 0.09; 'alias': 0.09; 'item,': 0.09; 'prevents': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'jan': 0.12; 'collections.': 0.16; 'iterable,': 0.16; 'none.': 0.16; 'rarely': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:requests': 0.16; 'worse.': 0.16; 'wrote:': 0.18; 'examples': 0.20; '>>>': 0.22; 'code,': 0.22; 'issue.': 0.22; 'otherwise,': 0.22; 'header:User-Agent:1': 0.23; 'possibly': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'change,': 0.30; 'especially': 0.30; "i'm": 0.30; 'lines': 0.31; '(usually': 0.31; 'exceptions': 0.31; 'trivial': 0.31; 'probably': 0.32; 'languages': 0.32; 'not.': 0.33; 'could': 0.34; 'basic': 0.35; 'something': 0.35; 'but': 0.35; 'add': 0.35; 'ordered': 0.36; 'returning': 0.36; 'doing': 0.36; 'method': 0.36; 'useful': 0.36; 'virtual': 0.37; 'represent': 0.38; 'to:addr:python-list': 0.38; 'rather': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'solve': 0.60; 'received:173': 0.61; 'skip:n 10': 0.64; 'between': 0.67; 'useful.': 0.68; 'default': 0.69; "'first'": 0.84; 'ethan': 0.84; 'furman': 0.84; 'received:fios.verizon.net': 0.84; 'ugly,': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: feature requests
Date Sat, 05 Oct 2013 17:56:03 -0400
References <6782f295-1885-4114-aea8-d785480f3489@googlegroups.com> <mailman.687.1380822918.18130.python-list@python.org> <ca517a69-edc7-468f-9e9e-94e61ea1014c@googlegroups.com> <5250370A.3010103@stoneleaf.us>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-173-75-251-66.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0
In-Reply-To <5250370A.3010103@stoneleaf.us>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.761.1381010189.18130.python-list@python.org> (permalink)
Lines 39
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1381010189 news.xs4all.nl 15928 [2001:888:2000:d::a6]:44917
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:56222

Show key headers only | View raw


On 10/5/2013 11:58 AM, Ethan Furman wrote:
> On 10/05/2013 05:49 AM, macker wrote:
>>>
>>> Ugly, menial lines are a clue that a function to hide it could be
>>> useful.
>>
>> Or a clue to add a trivial change elsewhere (hint for Ethan: `return
>> self` at the end of `Thread.start()`).
>
> I'm aware that would solve your issue.  I'm also aware that Python
> rarely does a 'return self' at the end of methods.

Not returning self is a basic design principle of Python since its 
beginning. (I am not aware of any exceptions and would regard one as 
possibly a mistake.) Guido is aware that not doing so prevents chaining 
of mutation methods. He thinks it very important that people know and 
remember the difference between a method that mutates self and one that 
does not. Otherwise, one could write 'b = a.sort()' and not know 
(remember) that b is just an alias for a. He must have seen this type of 
error, especially in beginner code, in other languages before designing 
Python.

 > Since that probably isn't going to change,

as it would only make things worse.

Note that some mutation methods also return something useful other than 
default None. Examples are mylist.pop() and iterator.__next__ (usually 
accessed by next(iterator)*. So it is impossible for all mutation 
methods to just 'return self'.

* iterator.__next__ is a generalized specialization of list.pop. It can 
only return the 'first' item, but can do so with any iterable, including 
those that are not ordered and those that represent virtual rather than 
concrete collections.

-- 
Terry Jan Reedy

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


Thread

feature requests macker <tester.testerus@gmail.com> - 2013-10-03 09:12 -0700
  Re: feature requests Chris Angelico <rosuav@gmail.com> - 2013-10-04 02:21 +1000
  Re: feature requests Tim Chase <python.list@tim.thechases.com> - 2013-10-03 11:42 -0500
  Re: feature requests Chris Angelico <rosuav@gmail.com> - 2013-10-04 02:42 +1000
  Re: feature requests Ethan Furman <ethan@stoneleaf.us> - 2013-10-03 10:01 -0700
    Re: feature requests macker <tester.testerus@gmail.com> - 2013-10-05 05:49 -0700
      Re: feature requests Ethan Furman <ethan@stoneleaf.us> - 2013-10-05 08:58 -0700
      Re: feature requests Terry Reedy <tjreedy@udel.edu> - 2013-10-05 17:56 -0400

csiph-web