Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed5.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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'that?': 0.05; 'completeness': 0.07; '(0,': 0.09; '0),': 0.09; '3),': 0.09; '[0,': 0.09; '1),': 0.16; '2),': 0.16; '3)]': 0.16; 'afterwards.': 0.16; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'received:dip.t-dialin.net': 0.16; 'received:t-dialin.net': 0.16; 'securities,': 0.16; 'subject:item': 0.16; 'tup': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'wrote:': 0.17; 'element': 0.17; '>>>': 0.18; 'insert': 0.23; 'monday,': 0.23; 'seems': 0.23; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'skip:[ 10': 0.26; 'accuracy': 0.27; 'merge': 0.27; 'subject:list': 0.28; 'chris': 0.28; 'fine': 0.28; '>>>>': 0.29; 'received:84': 0.32; 'to:addr:python-list': 0.33; 'list': 0.35; 'pm,': 0.35; 'subject:': 0.36; 'wanted': 0.36; 'email addr:python.org': 0.36; 'october': 0.37; 'why': 0.37; 'item': 0.37; 'sent:': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'think': 0.40; 'email name:python-list': 0.62; 'information,': 0.63; 'url:email': 0.63; 'legal': 0.65; 'subject': 0.66; 'purchase': 0.67; 'sale': 0.76; 'subject:before': 0.84 Date: Mon, 08 Oct 2012 23:39:26 +0200 From: Agon Hajdari User-Agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120912 Thunderbird/15.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Insert item before each element of a list References: <50733399.5040701@freenet.de> <5B80DD153D7D744689F57F4FB69AF474166DFE4C@SCACMX008.exchad.jpmchase.net> In-Reply-To: <5B80DD153D7D744689F57F4FB69AF474166DFE4C@SCACMX008.exchad.jpmchase.net> X-Enigmail-Version: 1.4.4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 33 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1349732492 news.xs4all.nl 6881 [2001:888:2000:d::a6]:35251 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:30975 On 10/08/2012 11:15 PM, Prasad, Ramit wrote: > Agon Hajdari wrote: >> Sent: Monday, October 08, 2012 3:12 PM >> To: python-list@python.org >> Subject: Re: Insert item before each element of a list >> >> On 10/08/2012 09:45 PM, Chris Kaynor wrote: >>> [('insertme', i) for i in x] >> >> This is not enough, you have to merge it afterwards. > > Why do you say that? It seems to work just fine for me. > >>>> x > [0, 1, 2, 3, 4] >>>> [('insertme', i) for i in x] > [('insertme', 0), ('insertme', 1), ('insertme', 2), ('insertme', 3), ('insertme', 4)] > >> >> y = [item for tup in y for item in tup] >> > > This email is confidential and subject to important disclaimers and > conditions including on offers for the purchase or sale of > securities, accuracy and completeness of information, viruses, > confidentiality, legal privilege, and legal entity disclaimers, > available at http://www.jpmorgan.com/pages/disclosures/email. > I think he wanted to have a 'plain' list a = [0, 1, 0, 2, 0, 3] and not a = [(0, 1), (0, 2), (0, 3)]