I am trying to extend a dict using
dict(existing, **kwargs)
But this does not work when the kwargs are coming via another function. Can someone help me understand why is this so?
Sample test code:
def funct(*args, **kwargs):
a = {'a': 1, 'b': 2}
print kwargs
return dict(a, **kwargs)
def thrgh(*v, **var):
print var
funct(*v, **var)
if __name__ == '__main__':
print 'hello world'
print funct(c=3)
print 'helloWorld-thrg'
print thrgh(c=3)
Output
hello world
{'c': 3}
{'a': 1, 'c': 3, 'b': 2}
helloWorld-thrg
{'c': 3}
{'c': 3}
None