On Sat, Dec 26, 2020 at 06:52:46PM -0800, Brendan Barnwell wrote:
> On 2020-12-26 18:44, Steven D'Aprano wrote:
> >>>> >I think if we were designing mapping protocols now, that would be an
> >>>> >excellent idea, but we aren't, we have decades of history from `dict`
> >>>> >behind us. And protocols from dict use `keys()` and getitem. E.g.
> >>>> >update.
> >>>
> >>>   What do you mean by "protocols from dict"?  What are these protocols?
> >"And protocols from dict use `keys()` and getitem. E.g. update."
> 
>       If I understand you right, that's not a protocol, that's just the 
> behavior of the dict type specifically.  As far as I can tell, it's not 
> even documented behavior, so it doesn't constrain anything.

Yes it is documented:

    help(dict.update)

and it was intentionally the inspiration for the behaviour of dict 
augmented assignment.

If you want to argue it's not a protocol, just an interface, okay, it's 
an interface. That's a difference that makes no difference.



-- 
Steve
_______________________________________________
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/2RBFMYAZ4QA2W4ZITAZVECBOF6WZST2E/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to