Passing variable number of named arguments
Ramashish Baranwal
ramashish.lists at gmail.com
Thu Dec 28 00:36:40 EST 2006
Carsten Haese wrote:
> On Wed, 2006-12-27 at 10:37 -0800, Ramashish Baranwal wrote:
> >[...]
> > def fun2(**kwargs):
> > # get id param
> > id = kwargs.pop('id', '')
> > # pass on remaining to fun1
> > fun1(kwargs)
> >
> > When I try to call fun2 I get the following error-
> >
> > TypeError: fun1() takes exactly 0 arguments (1 given)
> >
> > It seems that the arguments are not passed to fun1 as named arguments.
>
> You have to call fun1 like this: fun1(**kwargs).
Wow. thanks Carsten..
-Ram
More information about the Python-list
mailing list