Is it possible to get the keys that where changed when using the update method?
def func(**kw):
d = {'key0' : 0, 'key1' : 1}
d.update(**kw)
func(kw0=0, kw1=1)
In the above code I’d want to get the keys ‘kw0’ and ‘kw1’.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, once
update()is called, they are indistinguishable from the other keys.Inside the function you can still look at
kw.keys()to see which ones were passed ineg