[Python-ideas] Adding "+" and "+=" operators to dict
Stephen J. Turnbull
stephen at xemacs.org
Sat Feb 14 07:16:32 CET 2015
Chris Barker - NOAA Federal writes:
> > avoids any confusion over operators and having += duplicating the
> > update method.
>
> += duplicates the extend method on lists.
>
> And it's really redundant for numbers, too:
>
> x += y
>
> x = x + y
>
> So plenty of precedent.
Except for the historical detail that Guido dislikes them! (Or did.)
For a long time he resisted the extended assignment operators,
insisting that
x += 1
is best spelled
x = x + 1
I forget whether he ever said "if you're worried about inefficiency of
temp creation, figure out how to optimize the latter".
More information about the Python-ideas
mailing list