Re: [Tutor] Looking for a Pythonic way to pass variable

2005-03-22 Thread Sean Perry
Shidai Liu wrote: On Tue, 22 Mar 2005 15:27:02 -0500, Bill Mill <[EMAIL PROTECTED]> wrote: zip(K, *L) [(100, 1, 3), (200, 2, 4)] Any idea why zip(*L, K) fails? I believe the *'ed item needs to be the last argument. ___ Tutor maillist - Tutor@python.org

Re: [Tutor] Looking for a Pythonic way to pass variable

2005-03-22 Thread Shidai Liu
On Tue, 22 Mar 2005 15:27:02 -0500, Bill Mill <[EMAIL PROTECTED]> wrote: > >>> zip(K, *L) > [(100, 1, 3), (200, 2, 4)] Any idea why zip(*L, K) fails? -- With best wishes! Shidai ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/lis

Re: [Tutor] Looking for a Pythonic way to pass variable number of lists to zip()

2005-03-22 Thread Danny Yoo
> well, I would have said "apply(zip, (l1, l2, l3, ...))" but apply has > been deprecated in 2.3. Hi Sean, Sorry for straying away from the original poster's question, but do you know why apply() is being deprecated? This is new to me! ... ok, I see some discussion on it: http://mail.python.

Re: [Tutor] Looking for a Pythonic way to pass variable

2005-03-22 Thread Bill Mill
On Tue, 22 Mar 2005 13:30:09 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: > C Smith wrote: > > > > On Tuesday, Mar 22, 2005, at 05:01 America/Chicago, > > [EMAIL PROTECTED] wrote: > > > >> I met a similar question. > >> what if one has L = [[1,2],[3,4]], K = [100, 200] > >> How to 'zip' a List li

Re: [Tutor] Looking for a Pythonic way to pass variable

2005-03-22 Thread Kent Johnson
C Smith wrote: On Tuesday, Mar 22, 2005, at 05:01 America/Chicago, [EMAIL PROTECTED] wrote: I met a similar question. what if one has L = [[1,2],[3,4]], K = [100, 200] How to 'zip' a List like [[1,2,100], [3,4,200]]? I would do something like: ### for i in range(len(L)): L[i].append(K[i]) ### O

Re: [Tutor] Looking for a Pythonic way to pass variable

2005-03-22 Thread C Smith
On Tuesday, Mar 22, 2005, at 05:01 America/Chicago, [EMAIL PROTECTED] wrote: I met a similar question. what if one has L = [[1,2],[3,4]], K = [100, 200] How to 'zip' a List like [[1,2,100], [3,4,200]]? I would do something like: ### for i in range(len(L)): L[i].append(K[i]) ### /c _

Re: [Tutor] Looking for a Pythonic way to pass variable number of lists to zip()

2005-03-22 Thread Kent Johnson
Shidai Liu wrote: On Mon, 21 Mar 2005 22:51:31 -0800, Sean Perry <[EMAIL PROTECTED]> wrote: arg_list = [] # fill up arg_list zipped = zip(*arg_list) I met a similar question. what if one has L = [[1,2],[3,4]], K = [100, 200] What do you want to do with these lists? How to 'zip' a List like [[1,2,10

Re: [Tutor] Looking for a Pythonic way to pass variable number of lists to zip()

2005-03-22 Thread Shidai Liu
On Mon, 21 Mar 2005 22:51:31 -0800, Sean Perry <[EMAIL PROTECTED]> wrote: > Tony Cappellini wrote: > > well, I would have said "apply(zip, (l1, l2, l3, ...))" but apply has > been deprecated in 2.3. > > So how about this? > > arg_list = [] > # fill up arg_list > zipped = zip(*arg_list) > I met

Re: [Tutor] Looking for a Pythonic way to pass variable number of lists to zip()

2005-03-21 Thread Sean Perry
Tony Cappellini wrote: I have a program which currently passes 6 lists as arguments to zip(), but this could easily change to a larger number of arguments. Would someone suggest a way to pass a variable number of lists to zip() ? well, I would have said "apply(zip, (l1, l2, l3, ...))" but apply

[Tutor] Looking for a Pythonic way to pass variable number of lists to zip()

2005-03-21 Thread Tony Cappellini
I have a program which currently passes 6 lists as arguments to zip(), but this could easily change to a larger number of arguments. Would someone suggest a way to pass a variable number of lists to zip() ? ___ Tutor maillist - Tutor@python.org http: