[Python-ideas] PEP: Dict addition and subtraction
storchaka at gmail.com
Thu Mar 21 10:44:01 EDT 2019
21.03.19 15:24, Chris Angelico пише:
> On Fri, Mar 22, 2019 at 12:17 AM Serhiy Storchaka <storchaka at gmail.com> wrote:
>> 21.03.19 14:51, Chris Angelico пише:
>>> ... then, in the interests of productive discussion, could you please
>>> explain? What is it about dict addition that makes it harder to
>>> understand than other addition?
>> Currently the + operator has 2 meanings for builtin types (both are
>> widely used), after adding it for dicts it will have 3 meanings.
>> 3 > 2, is not?
> I suppose you could call it two (numeric addition and sequence
> concatenation), but there are subtleties to the way that lists
> concatenate that don't apply to strings (esp since lists are mutable),
> so I'd call it at least three already.
I do not understand what are these subtleties that you treat list
concatenation different from string concatenation. Could you please explain?
In any case, it does not matter how you count meanings, n + 1 > n.
More information about the Python-ideas