[Python-ideas] Dict joining using + and +=
Serhiy Storchaka
storchaka at gmail.com
Fri Mar 22 09:49:13 EDT 2019
04.03.19 15:43, Serhiy Storchaka пише:
> 01.03.19 12:44, Steven D'Aprano пише:
>> On Fri, Mar 01, 2019 at 08:47:36AM +0200, Serhiy Storchaka wrote:
>>> Also, if the custom dict subclass implemented the plus operator with
>>> different semantic which supports the addition with a dict, this change
>>> will break it, because dict + CustomDict will call dict.__add__ instead
>>> of CustomDict.__radd__.
>>
>> That's not how operators work in Python or at least that's not how they
>> worked the last time I looked: if the behaviour has changed without
>> discussion, that's a breaking change that should be reverted.
>
> You are right.
Actually there is still a problem if the first argument is an instance
of dict subclass that does not implement __add__.
More information about the Python-ideas
mailing list