On Mon, Jun 1, 2020 at 8:50 PM Brandt Bucher <brandtbuc...@gmail.com> wrote:

> > These would be mixin methods, not abstract. Set already implements the
> various operators based on the abstract methods, it could easily add more
> mixin methods which would delegate to the operators. Classes which override
> the operators with more efficient versions would automatically get
> efficient aliases for free.
>
> This same idea came up when we added `|` / `|=` to `dict` in 3.8. The
> reason we couldn't safely add those to `Mapping`/`MutableMapping` is that
> it could break compatibility for virtual subclasses that have been
> `register`-ed, and don't actually inherit from the ABC.
>
> The problem is the same here.


OK, I wasn't on this list then, and I haven't found much while searching. I
found a brief mention of the problem [here](
https://mail.python.org/archives/list/python-ideas@python.org/message/WX7PNKTOX2RIYKA4G2OC7RD4HHRLUSBA/)
without much explanation of why it might be a problem, and a reply saying
that it's not. So I may ask some questions that have been resolved already.

What do you mean by 'break compatibility'? Registering a virtual subclass
doesn't enforce that any methods are implemented, not even the abstract
ones.

Are virtual subclasses required to implement all the mixin methods? I
thought the mixin methods were just a nice conveniece, not a contract.
_______________________________________________
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/OP5IWIBGDTQ2DALLA52Q2C7ARUUHYIT7/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to