The .update()
method alters the dictionary in place and returns None
. The dictionary itself is altered, no altered dictionary needs to be returned.
Assign the dictionary first:
a_dict = dict(k=4, z=2)
a_dict.update(dict(l=1))
print a_dict
This is clearly documented, see the dict.update()
method documentation:
Update the dictionary with the key/value pairs from other, overwriting existing keys. Return
None
.