variable arguments question
Stephan Diehl
stephan.diehl at gmx.net
Tue Mar 15 03:10:44 EST 2005
On Tue, 15 Mar 2005 03:48:40 -0400, vegetax wrote:
> if i have a dictionary:
> d = {'a':2,'b':3 }
> l = (1,2)
>
> how can i pass it to a generic function that takes variable keywords as
> arguments? same thing with variable arguments, i need to pass a list of
> arguments to the function
>
> def asd(**kw): print kw
> def efg(*arg): print arg
>
> asd(d)
> doesnt work
> asd(kw = d)
> doesnt work
but asd(**d)
>
> efg(l)
> doesnt work
and efg(*l)
will work.
>
> i need to pass those as a dictionary and a list,since i dont know ahead of
> time if which items would have d and l
More information about the Python-list
mailing list