[Zope3-dev] Interface surprise

Shane Hathaway shane@zope.com
Mon, 31 Mar 2003 10:01:23 -0500


I've been using the following idiom in Zope 2 to discover whether an 
object is an interface definition:


from Interface import Interface

def isInterface(obj):
     return Interface.isImplementedBy(obj)


This idiom has a little surprise, though: any object that implements any 
interface also implements Interface.  Since the above function yields 
numerous false positives, I don't know the right way to detect whether 
an object is an Interface.

As a side effect, lots of objects promise to implement getBases(), 
extends(), getDescriptionFor(), etc., but they don't.

What should Zope 3 do to fix this?  Has anything been done already?

Shane