Re: Lists aggregation

2009-03-17 Thread Mensanator
On Mar 17, 2:18 am, Peter Otten <__pete...@web.de> wrote: > Mensanator wrote: > > On Mar 16, 1:40 pm, Peter Otten <__pete...@web.de> wrote: > >> mattia wrote: > >> > I have 2 lists, like: > >> > l1 = [1,2,3] > >> > l2 = [4,5] > >> > now I want to obtain a this new list: > >> > l = [(1,4),(1,5),(2,4

Re: Lists aggregation

2009-03-17 Thread mattia
Il Tue, 17 Mar 2009 08:18:08 +0100, Peter Otten ha scritto: > Mensanator wrote: > >> On Mar 16, 1:40 pm, Peter Otten <__pete...@web.de> wrote: >>> mattia wrote: >>> > I have 2 lists, like: >>> > l1 = [1,2,3] >>> > l2 = [4,5] >>> > now I want to obtain a this new list: l = >>> > [(1,4),(1,5),(2,4)

Re: Lists aggregation

2009-03-17 Thread Peter Otten
Mensanator wrote: > On Mar 16, 1:40 pm, Peter Otten <__pete...@web.de> wrote: >> mattia wrote: >> > I have 2 lists, like: >> > l1 = [1,2,3] >> > l2 = [4,5] >> > now I want to obtain a this new list: >> > l = [(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)] >> > Then I'll have to transform the values found in

Re: Lists aggregation

2009-03-16 Thread Mensanator
On Mar 16, 1:40 pm, Peter Otten <__pete...@web.de> wrote: > mattia wrote: > > I have 2 lists, like: > > l1 = [1,2,3] > > l2 = [4,5] > > now I want to obtain a this new list: > > l = [(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)] > > Then I'll have to transform the values found in the new list. > > Now, some

Re: Lists aggregation

2009-03-16 Thread Peter Otten
mattia wrote: > I have 2 lists, like: > l1 = [1,2,3] > l2 = [4,5] > now I want to obtain a this new list: > l = [(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)] > Then I'll have to transform the values found in the new list. > Now, some ideas (apart from the double loop to aggregate each element of > l1 with

Re: Lists aggregation

2009-03-16 Thread bearophileHUGS
mattia: > Now, some ideas (apart from the double loop to aggregate each element of > l1 with each element of l2): >>> from itertools import product >>> list(product([1,2,3], [4,5])) [(1, 4), (1, 5), (2, 4), (2, 5), (3, 4), (3, 5)] Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-

Re: Lists aggregation

2009-03-16 Thread Armin
On Monday 16 March 2009 15:07:06 mattia wrote: > I have 2 lists, like: > l1 = [1,2,3] > l2 = [4,5] > now I want to obtain a this new list: > l = [(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)] > Then I'll have to transform the values found in the new list. > Now, some ideas (apart from the double loop to agg

Lists aggregation

2009-03-16 Thread mattia
I have 2 lists, like: l1 = [1,2,3] l2 = [4,5] now I want to obtain a this new list: l = [(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)] Then I'll have to transform the values found in the new list. Now, some ideas (apart from the double loop to aggregate each element of l1 with each element of l2): - I want