[issue9705] limit dict.update() to a given list of keys

2010-08-28 Thread Raymond Hettinger

Raymond Hettinger  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

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9705] limit dict.update() to a given list of keys

2010-08-28 Thread Benjamin Peterson

Benjamin Peterson  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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9705] limit dict.update() to a given list of keys

2010-08-28 Thread Ultrasick

New submission from Ultrasick :

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: Ultrasick
priority: normal
severity: normal
status: open
title: limit dict.update() to a given list of keys
type: feature request
versions: Python 2.6, Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com