On 21/10/2019 14:54, David Mertz wrote:
On Mon, Oct 21, 2019, 9:14 AM Rhodri James
The plus operation on two dictionaries feels far more natural as
a vectorised merge, were it to mean anything. E.g., I'd expect
{'a': 5, 'b': 4} + {'a': 3, 'b': 1}
{'a': 8, 'b': 5}
That's only a natural expectation if you also expect the values in your
dict to be addable (in the sense of doing something useful with a "+"
operator). It never occurs to me to make that assumption because a fair
amount of the time it isn't true in my code.
I'm not arguing that we SHOULD make '+' mean recursive addition. I'm just
saying that if I never read this discussion, then later read `dict1 +
dict2` in code, that's what I'd expect.
And I'm just explaining why that's not what I expect. My code at the
moment looks more like
lookup_dict[remote_id] = RemoteObject(stuff)
so the idea of adding dict values simply doesn't come to me.
--
Rhodri James *-* Kynesim Ltd
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/J33SQQSU7RZFZZZCZFVIRTNURJLVMLMW/
Code of Conduct: http://python.org/psf/codeofconduct/