Re: Tuple of lists concatenation - function vs comprehension

2014-12-09 Thread Rustom Mody
On Monday, December 8, 2014 3:52:53 AM UTC+5:30, Terry Reedy wrote: > 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] >

Re: Tuple of lists concatenation - function vs comprehension

2014-12-07 Thread Terry Reedy
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 produc

RE: Tuple of lists concatenation - function vs comprehension

2014-12-07 Thread Ivan Evstegneev
age- From: Shiyao Ma [mailto:i...@introo.me] Sent: Sunday, December 7, 2014 17:18 To: Ivan Evstegneev Cc: python-list@python.org Subject: Re: Tuple of lists concatenation - function vs comprehension On 12/07, Ivan Evstegneev wrote: > Hello, > > When I have worked in Python shell (IDL

Re: Tuple of lists concatenation - function vs comprehension

2014-12-07 Thread Shiyao Ma
On 12/07, Ivan Evstegneev wrote: > Hello, > > When I have worked in Python shell (IDLE) I found this issue: > > >>>x = ([1, 2], [3, 4], [5, 6]) > >>>L = [] > >>>for I in x: > L.extend(i) > > >>>L > [1,2,3,4,5,6] > > But when I try to make comprehension using above expression, I get this: > >