This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年04月06日 21:55 by carsten.klein, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (2) | |||
|---|---|---|---|
| msg133173 - (view) | Author: Carsten Klein (carsten.klein) | Date: 2011年04月06日 21:55 | |
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... |
|||
| msg133205 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2011年04月07日 09:50 | |
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.
|
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:15 | admin | set | github: 55998 |
| 2013年10月06日 18:50:30 | georg.brandl | set | status: open -> closed resolution: works for me |
| 2011年04月07日 09:50:47 | georg.brandl | set | nosy:
+ georg.brandl messages: + msg133205 |
| 2011年04月06日 21:55:20 | carsten.klein | create | |