[Zope3-dev] Re: Proposal: Improving on __implements__
Steve Alexander
steve@cat-box.net
Mon, 20 Jan 2003 11:10:43 +0200
Yuppie wrote:
> Steve Alexander wrote:
>
>> 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
>> )
>
>
> Writing code like this (in Zope2) I always had the impression there is
> something wrong with the syntax:
>
> Normally I use a superclass because I want to use its interface
> implementation. Why do I have to add explicitly the inherited interfaces
> to the declaration?
Because explicit is better than implicit.
> I'd prefer a syntax like this:
>
>
> from zope.interface import addImplements
>
> class ServiceSubscriberEventChannel(SubscriptionTracker, EventChannel):
> """An event channel that wants to subscribe to the nearest
> event service when bound, and unsubscribe when unbound.
> """
>
> addImplements(IBindingAware)
That's an interesting idea. Thanks.
A note to anyone interested in this thread: In a few days, I'll collate
the replies and comments in the wiki, and post a summary of the points
raised.
--
Steve Alexander