<br><br><div class="gmail_quote">On Thu, Aug 27, 2009 at 9:16 AM, Emanuele D'Arrigo <span dir="ltr"><<a href="mailto:manu3d@gmail.com">manu3d@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Greetings everybody,<br>
<br>
let's say I have a Class C and I'd like to verify if it implements<br>
Interface I. If I is available to me as a class object I can use<br>
issubclass(C, I) and I can at least verify that I is a superclass of<br>
C. There are a couple of issues with this approach however:<br>
<br>
1) C might override not just I's methods code but also I's methods<br>
signatures, effectively changing the interface.<br>
2) What if I is -not- available to me as the superclass of C but as a<br>
description of the interface, i.e. as an IDL(*) file?<br>
<br>
Are there resources such as tools, recipes, documents or strategies<br>
that could help me deal with these issues? I've already looked into<br>
the ABC module and the zope.interface. I'm just fishing for more<br>
things to look at.<br>
<br>
Manu<br>
<br>
(*) <a href="http://en.wikipedia.org/wiki/Interface_description_language" target="_blank">http://en.wikipedia.org/wiki/Interface_description_language</a></blockquote><div><br>Python's general philosophy is that it's Easier to Ask Forgiveness than Permission. Don't check the interface, just assume it's true and wrap the code block in a try/except in case it isn't.</div>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></blockquote></div><br>