Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.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.041 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'subject:two': 0.07; 'momentarily': 0.09; 'am,': 0.12; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.16; 'subject:list': 0.18; 'header:In-Reply-To:1': 0.22; 'aug': 0.24; 'guess': 0.26; 'loop': 0.28; 'order.': 0.29; 'message-id:@mail.gmail.com': 0.29; 'sun,': 0.30; 'subject:?': 0.31; "what's": 0.33; 'to:addr:python- list': 0.33; 'do?': 0.34; 'subject:lists': 0.36; 'question': 0.36; 'but': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.39; 'why': 0.39; 'to:addr:python.org': 0.39; "it's": 0.40; 'more': 0.60; 'wish': 0.69; 'roberts': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=9u/p2d+jPJiIdrQefuoVjzj+wkk9dqxQEto7K9tUVfQ=; b=WPOwBsC+ypqyGLfPStIJeGKzTf5Gu+ODITLfYeZmmoP1KJyHwq9rUePFAe76kTZY0g HERjY94f1BABAEZgaPNhal7J39jyiYGGo8jrziutHkCoJRYCEMpApxSKGPHA2c3Y491h Dvcs0WcNb1hy1NnHefXihr/EFOVkEOugYbMtI= MIME-Version: 1.0 In-Reply-To: References: Date: Sun, 7 Aug 2011 02:05:14 +0100 Subject: Re: how to separate a list into two lists? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 1312679117 news.xs4all.nl 23837 [2001:888:2000:d::a6]:55461 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:10996 On Sun, Aug 7, 2011 at 1:58 AM, Tim Roberts wrote: > I did momentarily consider the following slimy solution: > =A0L1 =3D dict(L).keys() > =A0L2 =3D dict(L).values() > but that reorders the tuples. =A0They still correspond, but in a differen= t > order. > Which can be overcome with collections.OrderedDict. But what's dict(L) going to do? It's going to loop over L, more than once in fact. I guess the real question is: Why do you wish to avoid a loop? ChrisA