Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.83.MISMATCH!newsfeed.xs4all.nl!newsfeed4.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.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'mrab': 0.05; 'assignment': 0.07; 'try:': 0.09; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'table)': 0.16; 'tweak': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'split': 0.19; 'version.': 0.19; 'to:name:python- list@python.org': 0.22; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'dec': 0.30; 'subject:list': 0.30; 'message-id:@mail.gmail.com': 0.30; '13,': 0.31; 'fri,': 0.33; 'could': 0.34; 'received:google.com': 0.35; 'thanks': 0.36; 'to:addr:python- list': 0.38; 'that,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; "you're": 0.61; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=pWa2iia+6sSTmLAhRwgUpB2+zU7XyyPGlfWDyeHBGQk=; b=kaYYVyF9yvp6W3vP1ptTtqB2UYZDuZfm+SRWA2SbRrEaPPAOaX3mGBdiVAZbrXB3ZG foGFYhzhl+kNXlOPHCOdr5WMUbr9ICWLrmBSXWbEyK/IMUHKZXJ+I7tmc5wTZQS9NirU S26pirskAyuxMCKFjAvwyKe4TP1hHrwnceqpQtEYGhV02rWO49zcWaAbhmduA/hU6UUP BLYD5WdaJ6pRTcqdB36dZf4tCoJHRhRNxbk0pZ5uQ/1fvcGDRMrkEsb+6pKnAWNE06VG cmiYuUGVinQvgK3VEz8omUF9hn+3BoPSfRb5/tMEvyNeNxSm46CovRTNMwRWyr7qEPfy N58Q== MIME-Version: 1.0 X-Received: by 10.68.196.193 with SMTP id io1mr12654485pbc.46.1386857193352; Thu, 12 Dec 2013 06:06:33 -0800 (PST) In-Reply-To: <52A9BADB.7030701@mrabarnett.plus.com> References: <52a8fb2d$0$29992$c3e8da3$5496439d@news.astraweb.com> <52a9a75a$0$29992$c3e8da3$5496439d@news.astraweb.com> <52A9BADB.7030701@mrabarnett.plus.com> Date: Fri, 13 Dec 2013 01:06:33 +1100 Subject: Re: Optimizing list processing From: Chris Angelico To: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1386857197 news.xs4all.nl 2923 [2001:888:2000:d::a6]:43997 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:61713 On Fri, Dec 13, 2013 at 12:32 AM, MRAB wrote: >> table[:] = [i for x,i in table] # Does slice assignment get optimized? >> > [snip] > > If you're trying that, you could also try: > > table[:] = (i for x,i in table) Right, a tweak which could be applied also to the split version. Thanks MRAB. ChrisA