Currently, some type checkers rightly complain that a method is decorated 
with abc.abstractmethod when the class's type does not inherit from 
ABCMeta.  Adding a metaclass is a fairly heavy dependency since you're 
forced to poison all of your other metaclasses with the same base 
metaclass.  It also brings in possibly unwanted type registration that ABC 
comes with.

Now that abstractmethod's usage is extremely well-understood, would it make 
sense to move the checking logic out of ABCMeta?

It could either be put into object so that no base class is necessary (at 
the cost of slightly slower class creation), or else in a non-meta base 
class (say, HasAbstractMethods) now that __init_subclass__ is in all extant 
versions of Python.  Inheriting from such a non-meta base class would avoid 
the poisoning problem described above.

As far as I can tell, neither solution breaks code.

Best,

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

Reply via email to