"unlist" a list

pekka niiranen krissepu at vip.fi
Thu Jan 17 04:57:36 EST 2002


How about feeding function a list of parameters (para) ?

l1 = ['v1', 'v2']
 >>> l2 = ['op1','op2','op3']
 >>> para = l1 + l2
 >>> para
['v1', 'v2', 'op1', 'op2', 'op3']

-pekka-

Klaus Hoeppner wrote:

>Hi,
>maybe a silly question:
>
>I use a funktion that is defined as foo(v1,v2,*args), i.e. it is
>called as
>  a = foo(v1,v2,opt1,opt2,opt3...)
>(in fact in my case foo is Tkinter.OptionMenu)
>
>Unfortunately, I have the optional arguments in list
>  options = [opt1,opt2,opt3,...]
>and oviously foo(v1,v2,options) goes wrong since foo assumes that
>opt1 is the list options.
>So I would need something like a unlist-operator telling foo that
>the list is not the single first optional arguments but the members
>of the list are the optional arguments.
>
>Any idea?
>
>Regards
>Klaus
>




More information about the Python-list mailing list