Re: a question about zip...

2006-03-08 Thread Steve Holden
KraftDiner wrote: > I had a structure that looked like this > ((0,1), (2, 3), (4, 5), (6,7) > > I changed my code slightly and now I do this: > odd = (1,3,5,7) > even = (0,2,4,6) > all = zip(even, odd) > > however the zip produces: > [(0, 1), (2, 3), (4, 5), (6, 7)] > > Which is a list of tuples

Re: a question about zip...

2006-03-08 Thread Steven D'Aprano
KraftDiner wrote: > I had a structure that looked like this > ((0,1), (2, 3), (4, 5), (6,7) > > I changed my code slightly and now I do this: > odd = (1,3,5,7) > even = (0,2,4,6) > all = zip(even, odd) > > however the zip produces: > [(0, 1), (2, 3), (4, 5), (6, 7)] > > Which is a list of tuple

Re: a question about zip...

2006-03-08 Thread Diez B. Roggisch
KraftDiner schrieb: > I had a structure that looked like this > ((0,1), (2, 3), (4, 5), (6,7) > > I changed my code slightly and now I do this: > odd = (1,3,5,7) > even = (0,2,4,6) > all = zip(even, odd) > > however the zip produces: > [(0, 1), (2, 3), (4, 5), (6, 7)] > > Which is a list of tupl

RE: a question about zip...

2006-03-08 Thread Jeff Elmore
Just do: tuple(zip(even,odd)) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of KraftDiner Sent: Wednesday, March 08, 2006 3:22 PM To: python-list@python.org Subject: a question about zip... I had a structure that looked like this ((0,1), (2, 3), (4, 5

Re: a question about zip...

2006-03-08 Thread Xavier Morel
KraftDiner wrote: > I had a structure that looked like this > ((0,1), (2, 3), (4, 5), (6,7) > > I changed my code slightly and now I do this: > odd = (1,3,5,7) > even = (0,2,4,6) > all = zip(even, odd) > > however the zip produces: > [(0, 1), (2, 3), (4, 5), (6, 7)] > > Which is a list of tuples

Re: a question about zip...

2006-03-08 Thread Jan Niklas Fingerle
KraftDiner <[EMAIL PROTECTED]> wrote: > [(0, 1), (2, 3), (4, 5), (6, 7)] > > Which is a list of tuples.. I wanted a tuple of tuples... >>> odd = (1,3,5,7) >>> even = (0,2,4,6) >>> all = zip(even, odd) >>> all [(0, 1), (2, 3), (4, 5), (6, 7)] >>> tuple(all) ((0, 1), (2, 3), (4, 5), (6, 7)) Cheers

a question about zip...

2006-03-08 Thread KraftDiner
I had a structure that looked like this ((0,1), (2, 3), (4, 5), (6,7) I changed my code slightly and now I do this: odd = (1,3,5,7) even = (0,2,4,6) all = zip(even, odd) however the zip produces: [(0, 1), (2, 3), (4, 5), (6, 7)] Which is a list of tuples.. I wanted a tuple of tuples... -- http