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!newsfeed2.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.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'explicitly': 0.04; 'practice,': 0.07; 'used.': 0.07; 'iterate': 0.09; 'cc:addr :python-list': 0.10; 'programmer': 0.11; 'sat,': 0.15; 'agree.': 0.16; 'cc:name:python list': 0.16; 'guessing': 0.16; 'iterator': 0.16; 'janssen': 0.16; 'mutated': 0.16; 'order?': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'feb': 0.19; 'this:': 0.23; 'cc:2**1': 0.24; 'specifically': 0.24; 'cc:addr:python.org': 0.25; 'header:In- Reply-To:1': 0.25; 'values': 0.26; 'cc:addr:gmail.com': 0.27; 'order.': 0.27; 'object,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'correct': 0.28; 'this?': 0.28; 'chris': 0.28; 'knows': 0.30; 'point': 0.31; 'johnson': 0.32; 'structure': 0.32; 'agree': 0.34; 'received:google.com': 0.34; 'requiring': 0.35; 'doing': 0.35; 'pm,': 0.35; 'there': 0.35; 'method': 0.36; 'should': 0.36; 'why': 0.37; 'far': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'object': 0.38; 'gives': 0.39; 'apply': 0.39; 'think': 0.40; 'easy': 0.60; 'remove': 0.61; 'further': 0.61; 'more': 0.63; 'reverse': 0.65; 'potentially': 0.66; '2013': 0.84; 'advertises': 0.84; 'oscar': 0.84; 'rick': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=PmDEf2zqqi0FV1S/dO79ip4zUnlO6cleSZ/5L+0yZl8=; b=kYdPR4kszsmFkSuCy1lrmBBvy5BI9dQRLxvy15y1iX2uIsXCmS8vE15RK3NMNg21ZE NQVRh2gDSZ5AX4WVAKbP4Dyf61YFOt+GRR2gbe3+zeyLVozDr0MDRhGGN+4GqDCYjMYf 1ZX71vkqUuP4JmtYWh0fZaNxMv0I9ctThEWLyTykVLGsWesQ+n3kz5Ap+NFkTkG2x/Bw zXIp3buKsXQyUQvMWAiULnQQV74abQhuLlyeuds831ACjl2B8+MfCYhwczQK+16jRGx8 4fqrXR4eNcIr/5IZzCmBKZbwrSR8oQs0iuvb3uRj+s+jQSGdClhxd8Uxi/iuyUeMRNhB BdnQ== X-Received: by 10.152.125.239 with SMTP id mt15mr10109946lab.26.1360503020401; Sun, 10 Feb 2013 05:30:20 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <680e50a4-6569-49cf-b369-0be450545d50@googlegroups.com> <5115c455$0$6574$c3e8da3$5496439d@news.astraweb.com> From: Oscar Benjamin Date: Sun, 10 Feb 2013 13:30:00 +0000 Subject: Re: LangWart: Method congestion from mutate multiplicty To: Mark Janssen 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: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360503028 news.xs4all.nl 6954 [2001:888:2000:d::a6]:55099 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38568 On 10 February 2013 04:53, Mark Janssen wrote: > On Sat, Feb 9, 2013 at 8:20 PM, Chris Angelico wrote: >> On Sun, Feb 10, 2013 at 2:54 PM, Rick Johnson >> wrote: >>> My point was this: All mutate methods should mutate "in-place", if the programmer wishes to create a mutated copy of the object, then the programmer should /explicitly/ create a copy of the object and then apply the correct mutator method to the copy. >> >> I agree. And we can go further and declare that there is only one data >> [sarcasm] > > 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? > Guessing method names is far suboptimal to this simple, easy idiom. There is no guessing. If the object has a __reverse__ method then it specifically advertises that it knows how to create an iterator that gives its values in reverse order. Otherwise __len__ and __getitem__ are used. Oscar