[issue6410] Dictionaries should support __add__

Alexandre Vassalotti report at bugs.python.org
Fri Jul 3 23:37:01 CEST 2009


Alexandre Vassalotti <alexandre at peadrop.com> added the comment:

I am against adding __add__ to dict, since merging dictionaries is not a
commutative operation.

If a short syntax is desired for merging dictionaries, the just define a
function. For example: 

def merge_dicts(*args):
  result = {}
  for x in args:
    result.update(x)
  return result

----------
nosy: +alexandre.vassalotti
resolution:  -> rejected
status: open -> pending

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6410>
_______________________________________


More information about the Python-bugs-list mailing list