Does Class implements Interface?

Emanuele D'Arrigo manu3d at gmail.com
Thu Aug 27 09:16:14 EDT 2009


Greetings everybody,

let's say I have a Class C and I'd like to verify if it implements
Interface I. If I is available to me as a class object I can use
issubclass(C, I) and I can at least verify that I is a superclass of
C. There are a couple of issues with this approach however:

1) C might override not just I's methods code but also I's methods
signatures, effectively changing the interface.
2) What if I is -not- available to me as the superclass of C but as a
description of the interface, i.e. as an IDL(*) file?

Are there resources such as tools, recipes, documents or strategies
that could help me deal with these issues? I've already looked into
the ABC module and the zope.interface. I'm just fishing for more
things to look at.

Manu

(*) http://en.wikipedia.org/wiki/Interface_description_language



More information about the Python-list mailing list