Am 15.07.2008 um 20:53 schrieb Tim Cook:

If interface B inherits from interface A and class B implements
interface B; do I need to explicitly state that class B provides
interface A?

An instance of a class provides not only the interface the class declares to implement, but also all base interfaces of this interface. In particular an instance that povides any interface, will always provide 'Interface'.

Concrete example:

class IElement(Interface):
     value = Object(
        description=_(u"""Data value of this leaf."""),

class IDvText(IDataValue):


class DvText(DataValue):



The last line doesn't make any sense here. As I tried to explain before, if a class declares to 'implement' an interface, all of it's instances will provide it, whereby 'classProvides' declares the *class itself* to directly provide the interface.

Note: classes *implement* interfaces, their instances *provide* them.

Will Element.value allow instances of DvText or do I need to change the
DvText classProvides call to:


You probably don't want to use 'classProvides' at all. The 'implements(IDvText)' statement is enough for all instances of 'DvText' to provide 'IDataValue'.

Markus Kemmerling
Zope3-users mailing list

Reply via email to