On Wed, Jan 26, 2011 at 7:23 PM, Daniel Urban <urban.d...@gmail.com> wrote: >> That's just what I'd like and I suppose can't be currently done with >> current ABC, PyProtocols or zope.interface implementations, right? > > It can. With __instancecheck__ you can override isinstance. It is > possible (for example) to write a subclass of abc.ABCMeta, which > extends __instancecheck__ to use an _instancehook classmethod > similarly to __subclasshook__. Then in your MyInterface class you can > implement _instancehook to check for methods/signatures/whatever you > want.
Yes, __instancecheck__ could be used as an alternative hook with respect to maybe_implemented_by(), but there's no such logic for signature checking. That's a minor detail, I think. -- Alan Franzoni -- contact me at public@[mysurname].eu -- http://mail.python.org/mailman/listinfo/python-list