[Python-ideas] Adding "+" and "+=" operators to dict
Neil Girdhar
mistersheik at gmail.com
Wed Feb 18 09:39:28 CET 2015
On Tue, Feb 17, 2015 at 11:08 PM, Stephen J. Turnbull <stephen at xemacs.org>
wrote:
> C Anthony Risinger writes:
>
> > I'm not versed enough in the math behind it to know if it's expected or
> > not, but as it stands, to remain compatible with sets, `d1 | d2` should
> > behave like it does in my code (prefer the first, not the last). I
> kinda
> > like this, because it makes dict.__or__ a *companion* to .update(), not
> a
> > replacement (since update prefers the last).
>
> But this is exactly the opposite of what the people who advocate use
> of an operator want. As far as I can see, all of them want update
> semantics, because that's the more common use case where the current
> idioms feel burdensome.
>
>
yes, +1
also, if this goes through it should be added to collections.abc.Mapping
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150218/47ce0dbe/attachment.html>
More information about the Python-ideas
mailing list