Re: [Tutor] how to compare elements of 2 lists

2007-12-26 Thread Chris Fuller
On Wednesday 26 December 2007 10:03, Alan Gauld wrote: > I thought I was following this but now I'm not sure. > > Do you mean that if I have a list L that contains an arbitrary > > number of sublists that I can call zip using: > >>> zip(*L) > > rather than > > >>> zip(L[0],L[1],, L[n]) > > If s

Re: [Tutor] how to compare elements of 2 lists

2007-12-26 Thread Alan Gauld
"Chris Fuller" <[EMAIL PROTECTED]> wrote > "Arbitrary" means any size, and particularly, an unknown size. If > you don't > know how big the list is when you are writing the code, you need to > use this > syntax. > > It's also more concise and less error prone than zip(l[0], l[1], > l[2]) if yo

Re: [Tutor] how to compare elements of 2 lists

2007-12-26 Thread Chris Fuller
"Arbitrary" means any size, and particularly, an unknown size. If you don't know how big the list is when you are writing the code, you need to use this syntax. It's also more concise and less error prone than zip(l[0], l[1], l[2]) if you have got a 2D list of known length. On Wednesday 26 D

Re: [Tutor] how to compare elements of 2 lists

2007-12-26 Thread Kent Johnson
Chris Fuller wrote: > I didn't think of that. But for an arbitrary 2D list, you need the asterisk > syntax. I don't know what you mean by "an arbitrary 2D list". You need the * syntax when your arguments are *already* in a list. For any number of arguments, zip(*[a, b, ..., x, y, z]) can be