On 2019-10-21 01:18, Steven D'Aprano wrote:
On Fri, Oct 18, 2019 at 01:32:55PM -0700, Ethan Furman wrote:
On 10/18/2019 10:25 AM, Steven D'Aprano wrote:
>On Fri, Oct 18, 2019 at 09:17:54AM -0700, Ethan Furman wrote:
>
>>That result just doesn't match up with the '+' operator.
>
>Why not?
Pretty sure I answered that question in my OP. Here it is again since you
conveniently stripped it out:
I stripped it out because it doesn't answer the question. Restating it
word for word doesn't help.
Given the large number of meanings that we give the + symbol, what is it
specifically about merging two dicts (mappings) that doesn't match the
plus symbol? Which of the many uses of plus are you referring to?
Just stating, as you did, that + doesn't match dict merging is begging
the question: it doesn't match because we haven't defined the + operator
to mean merge. If we define the + operator to mean merge, then it will
match, by definition. For example, in Groovy and Kotlin, we can say that
dict merging matches + because that's the symbol they already use for
dict merging. Likewise, we can say the same thing about Python: Counter
already uses + to merge Counters.
[snip]
In the case of Counter, it supports both + and |.
The proposed operator will replace where there are matching keys. Which
operator of Counter does that? Neither.
BTW, my preference is for |.
_______________________________________________
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/M3UYZJ5NN6I2ZM7F6VTFM6O6R6NMJB5P/
Code of Conduct: http://python.org/psf/codeofconduct/