[Python-ideas] Adding "+" and "+=" operators to dict
Skip Montanaro
skip.montanaro at gmail.com
Thu Feb 12 16:21:36 CET 2015
On Wed, Feb 11, 2015 at 9:59 PM, Chris Angelico <rosuav at gmail.com> wrote:
> Does it have to be? It isn't commutative for strings or tuples either.
Good point. I never think of string "addition" as anything other than
concatenation. I guess the same would be true of dictionaries. Still,
if I add two strings, lists or tuples, the len() of the result is the
same as the sum of the len()s. That wouldn't necessarily be the case
for dictionaries, which, though well-defined, still can leave you open
for a bit of a surprise when the keys overlap.
Skip
More information about the Python-ideas
mailing list