passing **kwargs to a function

Abel Daniel abli at
Wed Mar 12 20:22:15 CET 2003

Bob Roberts (bobnotbob at wrote:
> Observe the folling code:
> def a(*args, **kwargs):
>     print args,kwargs
>     b(kwargs)
is what you want here
> def b(*args, **kwargs):
>     print args,kwargs
> a(a=1,b=2
> And it's output:
> () {'a': 1, 'b': 2}
> ({'a': 1, 'b': 2},) {}
> I am trying to pass int b() the exact same keyword arguments that were
> passed into it.  As you can see, it does't arrive in ths same way.  I
> want the kwargs variable inside a() and b() to be exactly the same. 
> How do I do that?

ps. use a real email address or one ending with .invalid
(bobnotbob at bounces with 'unknown user')

Abel Daniel

More information about the Python-list mailing list