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

Ethan Furman ethan at stoneleaf.us
Thu Feb 12 19:27:54 CET 2015


On 02/12/2015 10:21 AM, Thomas Kluyver wrote:

> Would this be less controversial if it were a new method rather than an odd use of an operator? I get the impression
> that most of the objections are especially against using an operator.
> 
> While I think the operator is elegant, I would be almost as happy with a method, e.g. updated(). It also makes the
> semantics very clear when e.g. Counter objects are involved:
> 
> new = a.updated(b)
> # equivalent to
> new = a.copy()
> new.update(b)

If we go with "updated" then it should be a separate function, like "sorted" and "reveresed" are.

--
~Ethan~

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150212/f507b629/attachment.sig>


More information about the Python-ideas mailing list