Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!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.118 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.77; '*S*': 0.00; "wouldn't": 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'readability.': 0.16; 'really?': 0.16; 'wrote:': 0.17; 'feb': 0.19; 'addition,': 0.21; 'assignment': 0.22; 'needed.': 0.23; 'header:In-Reply-To:1': 0.25; 'skip:[ 10': 0.26; 'message- id:@mail.gmail.com': 0.27; "d'aprano": 0.29; 'steven': 0.29; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'one,': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'easier': 0.38; 'to:addr:python.org': 0.39; 'called': 0.39; 'think': 0.40; 'skip:n 10': 0.63; 'other.': 0.64; 'six': 0.65; '2013': 0.84; 'actually,': 0.84; 'dozen': 0.91; 'scores': 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:content-type; bh=BHeN8c7yWAcBCcnZV4U3AhlsQDFqCZrNcCxJR6OtB7w=; b=y2lM+kU0U0t8D7n/5BqFQhUdEKQG77slPDCEfp+bsXdO01l9UiH6wot+gL20jQpZ9K U+TK3xtwROEL/Lrp156+RO0zGfcWES9Ui7G/K4yPbfDFxdzct/pDtoMambcvG29vLt2l HqUw3BSKMavkXEwNQSmwToyebES0v816MM95pZgTM+9OXICACXsblr2UNcFjLfXnX0ZJ Z/PtQ5yI08QpiI7VIrCTGrkuNzYwjn065WtvKGCF9utPcCrSmKLK/Y6xcg67ArpYxhcl ezClbHpokO+vHWGOWXXRUyiAGBCaK+ZIhdV08qT8+qYnDO07GvzhZ734kRzqt9bEfl9D 2Zog== MIME-Version: 1.0 X-Received: by 10.52.22.194 with SMTP id g2mr12958154vdf.91.1360502683531; Sun, 10 Feb 2013 05:24:43 -0800 (PST) In-Reply-To: <511784b3$0$29988$c3e8da3$5496439d@news.astraweb.com> References: <680e50a4-6569-49cf-b369-0be450545d50@googlegroups.com> <5115c455$0$6574$c3e8da3$5496439d@news.astraweb.com> <511784b3$0$29988$c3e8da3$5496439d@news.astraweb.com> Date: Mon, 11 Feb 2013 00:24:43 +1100 Subject: Re: LangWart: Method congestion from mutate multiplicty 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: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360502686 news.xs4all.nl 6977 [2001:888:2000:d::a6]:52063 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38567 On Sun, Feb 10, 2013 at 10:29 PM, Steven D'Aprano wrote: > "inserted" is called addition, together with list slicing when needed. > > newlist = [item_to_insert] + oldlist > newlist = oldlist[0:5] + [item_to_insert] + oldlist[5:] Really? Wouldn't it be easier to use slice assignment on a copy? newlist = oldlist[:]; newlist[pos:pos] = [item_to_insert] Actually, come to think of it, that scores about the same on readability. Six of one, half dozen of the other. ChrisA