[Python-ideas] Adding "+" and "+=" operators to dict

Eric Snow ericsnowcurrently at gmail.com
Fri Feb 13 16:03:22 CET 2015


On Thu, Feb 12, 2015 at 11:21 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> On Thu, Feb 12, 2015 at 07:52:09PM -0800, Andrew Barnert wrote:
>
>> > - Surely this change is minor enough that it doesn't need a PEP? It just
>> >  needs a patch and approval from a senior developer with commit
>> >  privileges.
>>
>> I'm not sure about this. If you want to change MutableMapping.update
>> too, you'll be potentially breaking all kinds of existing classes that
>> claim to be a MutableMapping and override update with a method with a
>> now-incorrect signature.
>
> Fair enough. It's a bigger change than I thought, but I still think it
> is worth doing.

Is there any need to change MutableMapping.update, at least for now?
Why not just focus on the signature of dict() and dict.update()?
dict.update() would continue to be compatible with a
single-positional-arg-signature MutableMapping.update so that
shouldn't be too big a deal.

-eric


More information about the Python-ideas mailing list