On 10/21/19 9:51 AM, Steven D'Aprano wrote:

Dicts are a key:value store, not a multiset, and outside of specialised
subclasses like Counter, we can't expect that adding the values is
meaningful or even possible. "Adding the values" is too specialised and
not general enough for dicts ...

Iterables are ordered collections of values, and outside of
specialized subclasses, we can't expect that adding the values
is meaningful or even possible.  "Adding the values" is too
specialized and not general enough for iterables.

And yet the builtin function sum exists and works the way it
does.

Lately, I tend to reduce or fold my collections rather than to
use symbolic operators, and to write specialized functions when
it comes to use cases like preferences.

I'd *almost* vote for | operating on the keys (because keys are
like a set) and + for operating on values (because adding one key
to another is more meaningless than adding arbitrary values), but
that doesn't seem quite right, either.
_______________________________________________
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/B2GKUVSKQC7KKDLTYKINSGNI66GHJYTU/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to