Abstract Base Class register function
musiccomposition at gmail.com
Sun Sep 28 04:53:53 CEST 2008
On Sep 27, 4:50 pm, "Mikolai Fajer" <mfa... at gmail.com> wrote:
> I have been experimenting with the abc module in py3k and thought
> about using the register method of an ABC as a class decorator:
> import abc
> class MyABC(metaclass=abc.ABCMeta):
> class MySub():
> This doesn't work because the register method returns None. It would
> be a fairly simple modification to have this work:
> def register(cls, subclass):
> """Register a virtual subclass of an ABC."""
> ... etc ...
> return subclass
> What do people think of this behavior?
It's probably better to just inherit from your metclass. register is
really for use with extension types that implement an interface.
> -Mikolai Fajer-
More information about the Python-list