Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed5.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'elegant,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'subject:Extracting': 0.09; 'compact': 0.16; 'guys,': 0.16; 'received:dip.t-dialin.net': 0.16; 'received:t-dialin.net': 0.16; 'throwaway': 0.16; 'wrote:': 0.18; 'seems': 0.19; 'avoiding': 0.23; 'from:addr:web.de': 0.23; 'creating': 0.25; 'code.': 0.26; 'skip:[ 10': 0.27; 'subject:?': 0.31; 'thanks': 0.31; 'list': 0.32; 'to:addr:python-list': 0.32; 'instead': 0.33; 'header:X -Complaints-To:1': 0.33; 'loop': 0.34; 'elegant': 0.34; 'subject:lists': 0.36; 'but': 0.37; 'think': 0.37; 'received:org': 0.37; 'move': 0.38; 'enough': 0.38; "it's": 0.39; 'why': 0.39; 'subject:: ': 0.39; 'to:addr:python.org': 0.39; 'more': 0.60; 'your': 0.61; 'subject:over': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: Re: Extracting elements over multiple lists? Date: Mon, 07 Nov 2011 19:33:01 +0100 Organization: None References: Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: p5084b384.dip.t-dialin.net 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1320690788 news.xs4all.nl 6910 [2001:888:2000:d::a6]:53836 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:15428 JoeM wrote: > 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 think it's a misconception that you are avoiding the for-loop. You move it into [...] and declare it more elegant, but in reality you are creating a throwaway list of None-s. You are adding cruft to your code. That is not only superfluous, but also misleading. A simple for-loop like for x in a, b, c: del x[0] on the other hand makes your intention crystal-clear.