Using Kwargs for unpacking elements from dictionary. Intrepreter throws unexpected keyword argument error.
def f (x, y, z) : return x + y * z
y = lambda x, y, z : x+y+z
print(f(**{ 'z' : 4 , 'x' : 1 , 'y' : 3 }))
print(y(**{ 'z' : 4 , 'x' : 1 , 'y' : 3 }))
print(f(**{ 'z' : 4 , "xx" : 1 , 'y' : 3 }))
print(y(**{ 'z' : 4 , 'xx' : 1 , 'y' : 3 }))
Error Msgs :
13
8
Traceback (most recent call last):
File "C:/Python39/test.py", line 8, in <module>
print(f(**{ 'z' : 4 , "xx" : 1 , 'y' : 3 }))
TypeError: f() got an unexpected keyword argument 'xx'
question from:
https://stackoverflow.com/questions/65839501/got-an-unexpected-keyword-argument 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…