[issue11789] Extend upon metaclass/type class documentation, here: zope.interface and usage of instances of classes as base classes

New submission from Carsten Klein <carsten.klein@axn-software.de>: In zope.interface, you have something the following construct: class InterfaceBase: pass Interface = InterfaceBase() Using the above Interface as a derivation base for your own classes, will make that instance a type derived class: class IFoo(Interface): pass type(IFoo) -> Interface type(Interface) -> type I wonder why this behavior is not documented in the official documentation, or at least, I was unable to find it there... ---------- assignee: docs@python components: Documentation messages: 133173 nosy: carsten.klein, docs@python priority: normal severity: normal status: open title: Extend upon metaclass/type class documentation, here: zope.interface and usage of instances of classes as base classes type: feature request versions: Python 3.2 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11789> _______________________________________

Georg Brandl <georg@python.org> added the comment: This doesn't work as you show. What you probably meant was something like this: class InterfaceBase(type): ... Interface = InterfaceBase('Interface', (), {}) class IFoo(Interface): ... which you can just as well do by using normal metaclass syntax. ---------- nosy: +georg.brandl _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11789> _______________________________________

Changes by Georg Brandl <georg@python.org>: ---------- resolution: -> works for me status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11789> _______________________________________
participants (2)
-
Carsten Klein
-
Georg Brandl