New submission from Ultrasick pyt...@ontheserver.de:
my_dict_1 = {'a' : 1, 'b' : 1}
my_dict_2 = {'a' : 2, 'b' : 2, 'c' : 2}
my_dict_1.update(my_dict_2, ['a', 'c'])
should result for my_dict_1:
{'a' : 2, 'b' : 1, 'c' : 2}
--
components: Interpreter Core
messages: 115157
nosy:
Benjamin Peterson benja...@python.org added the comment:
Please post to python-ideas first, and note a moratorium on builtin changes is
inplace.
--
nosy: +benjamin.peterson
resolution: - rejected
status: open - closed
___
Python tracker
Raymond Hettinger rhettin...@users.sourceforge.net added the comment:
FWIW, the usual way to spell this in Python is:
my_dict_1.update((k, my_dict_2[k]) for k in ['a', 'c'])
We try to keep filtering operations separate from map/fold operations for
orthognality.
--
nosy: +rhettinger