Re: Transform list comprehension back to traditional looping construct, how?

2014-06-01 Thread Hannu Krosing
On 06/01/2014 03:00 PM, Pepsodent Cola wrote: > At first I was trying to use list.append but then Python complained > that append could only take 1 argument. So I google around and > list.extend said that it could take more arguments so I just went with it. > > What is this right method you are

Re: Transform list comprehension back to traditional looping construct, how?

2014-06-01 Thread François Schiettecatte
.extend() takes as a parameter something that can be iterated over and appends it to the list. Something that can be iterated over includes other lists, sets, tuples, dictionaries, see https://docs.python.org/2/tutorial/datastructures.html François On Jun 1, 2014, at 9:00 AM, Pepsodent Cola

Re: Transform list comprehension back to traditional looping construct, how?

2014-06-01 Thread Pepsodent Cola
At first I was trying to use list.append but then Python complained that append could only take 1 argument. So I google around and list.extend said that it could take more arguments so I just went with it. What is this right method you are thinking about? My imagination is very limited I

Re: Transform list comprehension back to traditional looping construct, how?

2014-06-01 Thread Masklinn
On 2014-06-01, at 14:29 , Pepsodent Cola wrote: > Hi, I want to transform my articles_list5 list comprehension back to a > traditional looping construct to make things easier to read. > The articles_list5 returns a list of tuples. > > But when I try to do the same

Transform list comprehension back to traditional looping construct, how?

2014-06-01 Thread Pepsodent Cola
Hi, I want to transform my *articles_list5* list comprehension back to a traditional looping construct to make things easier to read. The articles_list5 returns a list of tuples. But when I try to do the same using traditional looping in *articles_list6* then I just get one long list from