[Python-ideas] A (meta)class algebra

Ethan Furman ethan at stoneleaf.us
Thu Feb 12 19:36:28 CET 2015


On 02/12/2015 05:42 AM, Martin Teichmann wrote:

> class MetaQRegistrar(MetaRegistrar, type(QObject)):
>     pass
> 
> but then you always have to write something like
> 
> class Spam(Registrar, QObject, metaclass=MetaQRegistrar):
>     pass

or:

  class RQObject(metaclass=MetaQRegistrar):
      pass

  class Spam(RQObject):
      pass

--
~Ethan~

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150212/8f886338/attachment.sig>


More information about the Python-ideas mailing list