[Python-Dev] PEP487: Simpler customization of class creation

Neil Girdhar mistersheik at gmail.com
Tue Jul 19 10:52:54 EDT 2016

Thanks for clarifying.

On Tue, Jul 19, 2016 at 10:34 AM Nick Coghlan <ncoghlan at gmail.com> wrote:

> On 19 July 2016 at 16:41, Neil Girdhar <mistersheik at gmail.com> wrote:
> > Yes, I see what you're saying.   However, I don't understand why
> > __init_subclass__ (defined on some class C) cannot be used to implement
> the
> > checks required by @abstractmethod instead of doing it in ABCMeta.  This
> > would prevent metaclass conflicts since you could use @abstractmethod
> with
> > any metaclass or no metaclass at all provided you inherit from C.
> ABCMeta also changes how __isinstance__ and __issubclass__ work and
> adds additional methods (like register()), so enabling the use of
> @abstractmethod without otherwise making the type an ABC would be very
> confusing behaviour that we wouldn't enable by default.
> But yes, this change does make it possible to write a mixin class that
> implements the "@abstractmethod instances must all be overridden to
> allow instances to to be created" logic from ABCMeta without otherwise
> turning the class into an ABC instance.
> Cheers,
> Nick.
> --
> Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20160719/326ef279/attachment.html>

More information about the Python-Dev mailing list