Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'essentially': 0.04; 'needed,': 0.05; 'none,': 0.05; 'line:': 0.07; 'reason,': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'terry': 0.09; 'def': 0.10; 'modification': 0.15; 'evaluates': 0.16; 'expression.': 0.16; 'in-place': 0.16; 'previously,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'reversed': 0.16; 'substituted': 0.16; 'wrote:': 0.17; 'jan': 0.18; 'proposed': 0.20; 'object.': 0.22; 'work.': 0.23; 'originally': 0.23; 'seems': 0.23; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'skip:" 20': 0.26; 'replace': 0.27; 'header:X-Complaints-To:1': 0.28; 'proposing': 0.29; "skip:' 10": 0.30; 'usually': 0.30; 'returned': 0.30; 'johnson': 0.32; 'not.': 0.32; "skip:' 20": 0.32; 'could': 0.32; 'to:addr:python- list': 0.33; 'list': 0.35; 'pm,': 0.35; 'received:org': 0.36; 'but': 0.36; 'does': 0.37; 'subject:: ': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'list,': 0.39; 'header:Received:5': 0.40; '*does': 0.84; '2013': 0.84; 'received:fios.verizon.net': 0.84; 'tem': 0.84; 'try,': 0.84; 'rick': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: LangWart: Method congestion from mutate multiplicty Date: Sun, 10 Feb 2013 16:44:25 -0500 References: <680e50a4-6569-49cf-b369-0be450545d50@googlegroups.com> <5115c455$0$6574$c3e8da3$5496439d@news.astraweb.com> <14880592-debf-42de-8756-e47e59aeb302@googlegroups.com> 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:17.0) Gecko/20130107 Thunderbird/17.0.2 In-Reply-To: <14880592-debf-42de-8756-e47e59aeb302@googlegroups.com> 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: 45 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360532685 news.xs4all.nl 6969 [2001:888:2000:d::a6]:56186 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38603 On 2/10/2013 1:45 PM, Rick Johnson wrote: > On Sunday, February 10, 2013 2:39:21 AM UTC-6, Terry Reedy wrote: >> While it is true that sorted(iterable) is essentially >> >> def sorted(iterable): >> tem = list(iterable) >> tem.sort >> return tem >> >> the body is not an expression and cannot be substituted in an >> expression. > > Yes but the body can be compressed to this single line: "list(iterable).sort()" That single line now evaluates to None, so that does not work. >> Even if list mutation methods returned the list, which they do not and >> for good reason, > > I am not proposing that in-place modification return the object. It seems to me that you are, as that is the only way for 'list(iterable).sort()' to replace 'sorted(iterable)', as you proposed both originally and above. The reason sorted(iterable) was added is 'list(iterable).sort()', which newbies would try, *does not work*. Sorted was added so people would not have to write tem = list(iterable) tem.sort() del tem as they did previously, and instead could write Reversed was added not only for the same reason, but also to avoid the temporary list altogether when not actually needed, which it often or usually is not. -- Terry Jan Reedy