Can one be sure that key-value arguments will put in the dictionary (kv
below) in the order they are given, and that the dictionary will be iterated in that order too? In this peculiar example it matters:
def func(**kv):
s = 0
for key in kv:
s += func2(key,kv[key])
def func2(key,val):
if key=="all":
a=val
b=val
elif key=="a":
a = val
elif key=="a":
b = val
return a+b
a=b=0
func(all=3,a=2,b=1)