Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'explicit': 0.07; 'none,': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:skip:c 10': 0.09; 'jan': 0.12; '2],': 0.16; '[none,': 0.16; 'ivan': 0.16; 'none]': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'see,': 0.30; '>>>>': 0.31; 'style': 0.33; 'subject:lists': 0.35; 'but': 0.35; 'there': 0.35; "i'll": 0.36; 'wrong': 0.37; 'list': 0.37; 'to:addr:python- list': 0.38; 'bad': 0.39; 'itself': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'expression': 0.60; 'kind': 0.63; 'received:fios.verizon.net': 0.84; 'received:108': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Tuple of lists concatenation - function vs comprehension Date: Sun, 07 Dec 2014 17:21:37 -0500 References: <001a01d0122f$86b95480$942bfd80$@gmail.com> <20141207151749.GB32773@FuzzyHorror> <001b01d01232$77700840$665018c0$@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-108-16-203-145.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: <001b01d01232$77700840$665018c0$@gmail.com> 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1417990918 news.xs4all.nl 2900 [2001:888:2000:d::a6]:40610 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:82078 On 12/7/2014 10:28 AM, Ivan Evstegneev wrote: > Hi Shiyao, > > Now I see, that it was kind of dumb question... > >>>>> x = ([1, 2], [3, 4], [5, 6]) >>>>> L = [] >>>> [L.extend(i) for i in x] > [None, None, None] Using a list comprehension for the expression side-effect, when you do not actually want the list produced by the comprehension, is considered bad style by many. There is nothing wrong with explicit loops. > BUT when I check L itself I'll see this one > >>>> L > [1,2,3,5,6] -- Terry Jan Reedy