"unlist" a list

Daniel Dittmar daniel.dittmar at sap.com
Thu Jan 17 04:52:37 EST 2002


> 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.

use foo (v1, v2, *options)
or (in older Pythons) apply (foo, (v1, v2) + tuple (options))

Daniel






More information about the Python-list mailing list