[Python-ideas] Abstract metaclasses?

Ethan Furman ethan at stoneleaf.us
Wed Sep 10 23:41:21 CEST 2014


On 09/10/2014 01:59 PM, Erik Bray wrote:
>
> --> import abc
> --> class Meta(type, metaclass=abc.ABCMeta):
> ...     @abc.abstractmethod
> ...     def foo(cls): pass
> ...
> --> class A(metaclass=Meta): pass
> ...
> --> A
> <class '__main__.A'>

I think this is a bug.  However, if the class were:

   --> class A(metaclass=Meta):
   ...     def foo(self):
   ...          pass
   ...

Then this should succeed, and I don't think your Abstractable type allows it.

--
~Ethan~


More information about the Python-ideas mailing list