Why does dict(k=4, z=2).update(dict(l=1)) return None? It seems as if it should return dict(k=4, z=2, l=1)? I\'m using Python 2.7 shou
For completion's sake, if you do want to return a modified version of the dictionary, without modifying the original you can do it like this:
original_dict = {'a': 'b', 'c': 'd'}
new_dict = dict(original_dict.items() + {'c': 'f', 'g': 'h'}.items())
Which gives you the following:
new_dict == {'a': 'b', 'c': 'f', 'g': 'h'}
original_dict == {'a': 'b', 'c': 'd'}