Append to python List

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu May 9 07:14:47 EDT 2013


On Thu, 09 May 2013 01:18:51 -0700, RAHUL RAJ wrote:

> Then what about this code part?


What about it? 


> [(x, y) for x in [1,2,3] for y in [3,1,4] if x != y]
> 
> and the following code part:
> 
> for x in [1,2,3]:
>   for y in [3,1,4]:
>     if x != y:
>       combs.append((x, y))

Apart from not defined combs, those two pieces of code are equivalent.

So what is your question?


-- 
Steven



More information about the Python-list mailing list