This is more of a curiosity than a necessary use case but I would like to edit the following behavior:
>>> from collections import ChainMap
>>> x={'a':3,'b':4,'c':5}
>>> y={'d':33,'e':45,'c':7}
>>> z={'aa':3,'bb':4,'cc':5}
>>> def foo(a,b,c,cc,**kwargs):
... print(a,b,c,cc)
>>> map = ChainMap(x,y,z)
>>> map
ChainMap({'a': 3, 'b': 4, 'c': 5}, {'d': 33, 'e': 45, 'c': 7}, {'aa': 3, 'bb': 4, 'cc': 5})
>>> foo(**map)
3 4 5 5
Is it at all possible to change the behavior of **
do custom things like return the sum of repeated keys
. In the above case it would print 3 4 12 5
or give the last instance not the first 3 4 7 5
?