
On Sat, Dec 26, 2020 at 09:18:09PM -0800, Brendan Barnwell wrote:
Yes it is documented:
help(dict.update)
and it was intentionally the inspiration for the behaviour of dict augmented assignment.
I see. It's rather disturbing that that isn't mentioned in the docs on python.org.
"Disturbing"? It's an oversight, not a conspiracy :-)
Just submit a PR and I'm sure it will be accepted.
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.
No, it does make a difference. What you're describing is the interface to a single existing type.
It's part of the MutableMapping ABC, although you need to read the source code of that (or the doctsring) to see it:
https://github.com/python/cpython/blob/3.9/Lib/_collections_abc.py