On Wed, Aug 26, 2020 at 1:47 AM Greg Ewing <greg.ew...@canterbury.ac.nz>
wrote:

> As a point of interest, is get() considered an official part of the
> mapping protocol, or just nice-to-have?
>
> The docs don't seem to be very clear about that. There used to be
> some tables listing the methods making up the core sequence and
> mapping protocols, but I can't find them now. Have they been removed?
> Are the ABCs now the definitions of the protocols?
>

 I would also like to see an official answer to this. Are the mixin methods
of the ABCs considered part of their contract? Is it documented somewhere?
I think it should be.

On the one hand it sort of feels like the contract is just the abstract
methods that users are supposed to implement themselves, and the mixin
methods are just a convenient benefit of subclassing. It's hard to say
where that feeling comes from, but I think the name "mixin method" is part
of it. I'm glad to see I'm not the only one that gets this feeling.

On the other hand, if I have a variable of type Mapping, I'm usually going
to assume it has a .get method that behaves like dict. Most tools will
assume that too. If it doesn't, I'll be quite surprised and probably
annoyed.
_______________________________________________
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/UCJXMBLFIFLTB7ITAW6UQHW6JBMZKHDP/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to