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

Alexander Belopolsky alexander.belopolsky at gmail.com
Thu Feb 12 17:18:16 CET 2015


On Thu, Feb 12, 2015 at 5:43 AM, Steven D'Aprano <steve at pearwood.info>
wrote:

> A very strong -1 on the proposal. We already have a perfectly good way
> to spell dict += , namely dict.update. As for dict + on its own, we have
> a way to spell that too: exactly as you write above.
>

Another strong -1 from me.  In my view, the only operation on dictionaries
that would deserve to be denoted + would be counter or sparse array
addition, but we already have collections.Counter and writing a sparse
array (as in sa(a=1,c=-2) + sa(a=1,b=1,c=1) == sa(a=2,b=1,c=-1)) is a
simple exercise.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150212/d66418e1/attachment.html>


More information about the Python-ideas mailing list