Re: zip list, variables

2013-11-21 Thread Peter Otten
flebber wrote: > Thank you for the replies. > > Looking at the replies I am wondering which solution is more scalable. At > the moment it is only 2 nested lists but what about 5, 10, 20 or more? > > Should I start looking into numpy to handle this or will list > comprehension > >>> [ [ x + y f

Re: zip list, variables

2013-11-20 Thread Steven D'Aprano
On Wed, 20 Nov 2013 12:05:38 -0800, flebber wrote: > Thank you for the replies. > > Looking at the replies I am wondering which solution is more scalable. > At the moment it is only 2 nested lists but what about 5, 10, 20 or > more? > > Should I start looking into numpy to handle this or will lis

Re: zip list, variables

2013-11-20 Thread flebber
Thank you for the replies. Looking at the replies I am wondering which solution is more scalable. At the moment it is only 2 nested lists but what about 5, 10, 20 or more? Should I start looking into numpy to handle this or will list comprehension >>> [ [ x + y for x, y in zip(x,y) ] for x, y

Re: zip list, variables

2013-11-20 Thread Jussi Piitulainen
flebber writes: > If > > c = map(sum, zip([1, 2, 3], [4, 5, 6])) > > c > Out[7]: [5, 7, 9] > > why then can't I do this? > > a = ([1, 2], [3, 4]) > > b = ([5, 6], [7, 8]) > > c = map(sum, zip(a, b)) > --- > TypeError

Re: zip list, variables

2013-11-20 Thread Peter Otten
flebber wrote: > If > > c = map(sum, zip([1, 2, 3], [4, 5, 6])) > > c > Out[7]: [5, 7, 9] > > why then can't I do this? > > a = ([1, 2], [3, 4]) > > b = ([5, 6], [7, 8]) > > c = map(sum, zip(a, b)) > --- > TypeError