[Zope3-dev] Proposal: Improving on __implements__
Steve Alexander
steve@cat-box.net
Sun, 19 Jan 2003 01:09:43 +0200
Hi folks,
I've added a new proposal to the zope3 development wiki.
It is called "Improving on __implements__'.
http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/BetterInterfaceImplements
The main thing I'm proposing is to simplify the syntax for declaring
what interfaces are implemented by instances of a class and so forth.
Here's an example from the proposal to give you a flavour, but please
read the proposal before replying here.
class ServiceSubscriberEventChannel(SubscriptionTracker, EventChannel):
"""An event channel that wants to subscribe to the nearest
event service when bound, and unsubscribe when unbound.
"""
__implements__ = (
EventChannel.__implements__,
SubscriptionTracker.__implements__,
IBindingAware
)
Becomes this:
from zope.interface import implements, implementsLike
class ServiceSubscriberEventChannel(SubscriptionTracker, EventChannel):
"""An event channel that wants to subscribe to the nearest
event service when bound, and unsubscribe when unbound.
"""
implementsLike(EventChannel, SubscriptionTracker)
implements(IBindingAware)
--
Steve Alexander