Steven D'Aprano wrote:
> On Sat, Mar 05, 2022 at 11:27:44AM +0200, Serhiy Storchaka wrote:
> > Currently the class can inherit from arbitrary objects, not only types.
> > Is that intentionally supported?
> I know that metaclasses do not have to be actual classes, they can be 
> any callable with the correct signature, but I didn't know that classes 
> can inherit from non-classes.

zope.interface relies on this behaviour.

py> from zope.interface import Interface
py> class IFoo(Interface):
...     def a_method():
...        """Does stuff"""
...
py> type(Interface)
<class 'zope.interface.interface.InterfaceClass'>
py> type(IFoo)
<class 'zope.interface.interface.InterfaceClass'>
py> isinstance(IFoo, type)
False
py> isinstance(Interface, type)
False
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/EOEFTHD4POWRCT7FGBE5WT6IZGZNG2LX/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to