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

Petr Viktorin encukou at gmail.com
Fri Feb 13 16:27:12 CET 2015


On Fri, Feb 13, 2015 at 4:03 PM, Eric Snow <ericsnowcurrently at gmail.com> wrote:
> 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.

At this point this would just be doc change (actually, a doc
addition): specifying semantics for multiple positional arguments, and
saying that the new signature is preferred.
I'm not proposing to add the warning now.


More information about the Python-ideas mailing list