Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #15427

Re: Extracting elements over multiple lists?

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!panix!gordon
From John Gordon <gordon@panix.com>
Newsgroups comp.lang.python
Subject Re: Extracting elements over multiple lists?
Date Mon, 7 Nov 2011 18:22:00 +0000 (UTC)
Organization PANIX Public Access Internet and UNIX, NYC
Lines 17
Message-ID <j997k8$rib$1@reader1.panix.com> (permalink)
References <b9e53a75-7490-4b6a-844a-20cfce263939@a12g2000vbz.googlegroups.com> <j995eq$vr9$1@news.univ-fcomte.fr> <cf007146-3a08-44c4-bf01-d1a9253c83e3@o19g2000vbk.googlegroups.com>
NNTP-Posting-Host panix3.panix.com
X-Trace reader1.panix.com 1320690120 28235 166.84.1.3 (7 Nov 2011 18:22:00 GMT)
X-Complaints-To abuse@panix.com
NNTP-Posting-Date Mon, 7 Nov 2011 18:22:00 +0000 (UTC)
User-Agent nn/6.7.3
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:15427

Show key headers only | View raw


In <cf007146-3a08-44c4-bf01-d1a9253c83e3@o19g2000vbk.googlegroups.com> JoeM <josephmeiring@gmail.com> writes:

> Thanks guys, I was just looking for a one line solution instead of a
> for loop if possible. Why do you consider

> [x.remove(x[0]) for x in [a,b,c]]

> cheating? It seems compact and elegant enough for me.

I wouldn't call it cheating, but that solution does a fair bit of
unneccessary work (creating a list comprehension that is never used.)

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon@panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Extracting elements over multiple lists? JoeM <josephmeiring@gmail.com> - 2011-11-07 09:12 -0800
  Re: Extracting elements over multiple lists? John Gordon <gordon@panix.com> - 2011-11-07 17:37 +0000
  Re: Extracting elements over multiple lists? Laurent Claessens <moky.math@gmail.com> - 2011-11-07 18:44 +0100
    Re: Extracting elements over multiple lists? JoeM <josephmeiring@gmail.com> - 2011-11-07 10:01 -0800
      Re: Extracting elements over multiple lists? John Gordon <gordon@panix.com> - 2011-11-07 18:22 +0000
        Re: Extracting elements over multiple lists? Terry Reedy <tjreedy@udel.edu> - 2011-11-07 19:06 -0500
      Re: Extracting elements over multiple lists? Peter Otten <__peter__@web.de> - 2011-11-07 19:33 +0100
      Re: Extracting elements over multiple lists? Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-11-07 19:51 +0100
      Re: Extracting elements over multiple lists? Dave Angel <d@davea.name> - 2011-11-07 15:06 -0500
      Re: Extracting elements over multiple lists? Laurent Claessens <moky.math@gmail.com> - 2011-11-08 08:07 +0100
      RE: Extracting elements over multiple lists? "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2011-11-15 17:01 +0000
        Re: Extracting elements over multiple lists? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-15 22:21 +0000
      Re: Extracting elements over multiple lists? Dave Angel <d@davea.name> - 2011-11-15 13:17 -0500
      Re: Extracting elements over multiple lists? Chris Angelico <rosuav@gmail.com> - 2011-11-16 06:53 +1100
        Re: Extracting elements over multiple lists? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-15 22:25 +0000
          Re: Extracting elements over multiple lists? Chris Angelico <rosuav@gmail.com> - 2011-11-16 09:54 +1100
    Re: Extracting elements over multiple lists? Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-11-07 19:06 +0100

csiph-web