[Python-ideas] dict '+' operator and slicing support for pop

Raymond Hettinger python at rcn.com
Tue Mar 17 19:17:02 CET 2009

>> a.update(b)
>> return a

Why take two short, simple lines with unequivocal meaning
and then abbreviate them with something mysterious (or
at least something with multiple possible interpretations)?

Mappings exist in many languages now.  Can you point
to another language that has found it worthwhile to have
both an update() method and an addition operator?

Also, consider that dicts are one of our most basic APIs
and many other objects model that API.  It behooves us
to keep that API as simple and thin as possible.

IMO, this change would be gratuituous.  None of the code
presented so far is significantly improved.  Essentially, we're
looking at a trivial abbreviation, not an actual offering of
new capabilities.

-1 all the way around.


More information about the Python-ideas mailing list