Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.mixmin.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.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.016 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'explicitly': 0.04; 'practice,': 0.07; 'iterate': 0.09; 'cc:addr:python-list': 0.10; 'steve': 0.13; 'cases': 0.15; '"user': 0.16; 'benjamin': 0.16; 'cc:name:python list': 0.16; 'janssen': 0.16; 'order?': 0.16; 'sorted()': 0.16; 'wrote:': 0.17; 'documented': 0.17; 'feb': 0.19; 'issue.': 0.20; 'cc:2**1': 0.24; 'machine': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'common': 0.26; 'am,': 0.27; 'cc:addr:gmail.com': 0.27; 'right.': 0.27; 'object,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'this?': 0.28; "d'aprano": 0.29; 'existence': 0.29; 'fast.': 0.29; 'probably': 0.29; 'structure': 0.32; 'point,': 0.33; 'agree': 0.34; 'received:google.com': 0.34; 'requiring': 0.35; 'doing': 0.35; 'there': 0.35; 'but': 0.36; 'programmers': 0.36; 'should': 0.36; 'thank': 0.36; 'too': 0.36; 'why': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'where': 0.40; 'think': 0.40; 'remove': 0.61; 'real': 0.61; 'more': 0.63; 'reverse': 0.65; 'potentially': 0.66; 'special': 0.73; '2013': 0.84; 'idiom': 0.84; 'oscar': 0.84; 'rick': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=IYlmzCWfuLO2bzeZiqXRJp0PdGFZx7txt1fTpY5EaQ4=; b=dbjuSNCPDwlvVH5fOM+kxW+6QyF/qS34ICHK2Adlf8O46Km6gCMF0lsFS6eir5AnkE jieKAZdc5/QBXxL8V6W5i0HzNkpMXTaVEXCbhXgy+rHCXtj+WrGJ8RNLTpN0j7l9NYtN f5sxusOQSPRHCdWlbKS9Be0+WsaQlmo/jB29yQ05trhrAV/xvqAjHmN/fsoO5qy3PiUz wnmVGg0S0u/1EpDT2to8dbywzwDJIocEikl0kVGrKywWjkThUweQJzznFuAf39cvxO2p ZcWaSXHH21Aw+8f5pZgTCcpuGlvyCwQ5MNUoSNnm3HMkRdUDfirfXm5jSvUo4FY7oeTS nzQA== MIME-Version: 1.0 X-Received: by 10.180.8.4 with SMTP id n4mr11939905wia.13.1360521903808; Sun, 10 Feb 2013 10:45:03 -0800 (PST) In-Reply-To: References: <680e50a4-6569-49cf-b369-0be450545d50@googlegroups.com> <5115c455$0$6574$c3e8da3$5496439d@news.astraweb.com> Date: Sun, 10 Feb 2013 10:45:03 -0800 Subject: Re: LangWart: Method congestion from mutate multiplicty From: Mark Janssen To: Oscar Benjamin Content-Type: text/plain; charset=ISO-8859-1 Cc: Python List 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: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360521910 news.xs4all.nl 6918 [2001:888:2000:d::a6]:33909 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38594 On Sun, Feb 10, 2013 at 5:30 AM, Oscar Benjamin wrote: > On 10 February 2013 04:53, Mark Janssen wrote: >> I have to agree with Rick, I think requiring the user to explicitly >> create a new object, which is already a good and widely-used practice, >> should be the Only One Way to Do It. > > Why should I copy a potentially large data structure just to iterate > over it in reverse order? And why on earth would you want to remove > the more efficient ways of doing this? You're right. I responded too fast. I think reversed() and sorted() might be the only legit methods in this regard and I thank Steve D'Aprano for pointing that out. But Rick still has a valid point: it should not be taken as a general practice. The point, as I see it, is that there's no clear, documented standard on the "right way" for people to think about the issue. The existence of sorted() and reversed() actually *misinform* programmers as if this is the best practice. It isn't, it just that these are very special cases (one for a real machine efficiency and one for a very common "user efficiency") and there should probably be documentation to make that clear, so programmers don't start going that direction. I don't think there are other cases where such an idiom would be recommended. Mark