[Python-ideas] Adding "+" and "+=" operators to dict

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Feb 12 22:29:04 CET 2015


Chris Barker - NOAA Federal wrote:
> Yes, we have dict.update(), but the entire reason += exists (all the
> augmented assignment operators -- they are called that, yes?) is
> because we didn't want methods for everything.

But it's mean to be an in-place version of whatever the
+ operator does on that type. It doesn't make sense for
a type that doesn't have a + operator.

(And no, you can't argue that dict should be given a
+ operator just so you can give it a += operator!)

-- 
Greg


More information about the Python-ideas mailing list