passing **kwargs to a function
Bob Roberts
bobnotbob at byu.edu
Tue Mar 11 22:40:44 EST 2003
Observe the folling code:
def a(*args, **kwargs):
print args,kwargs
b(kwargs)
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?
More information about the Python-list
mailing list