On Fri, Aug 26, 2005 at 10:17:07AM +0400, email@example.com wrote:
Let's say we defined an interface and an adapter:
class IFoo(zope.interfaces.Interface): pass
twisted.python.components.registerAdapter(Foo, Bar, IFoo)
As it is for now, the registerAdapter accepts any Foo, without regarding what it implements.
It has to accept pretty much anything -- adapters can be e.g. functions as well as classes.
Could somebody give any rationale why this condition shouldn't always hold:
foo = IFoo(bar) assert IFoo.providedBy(foo)
Seems it is not unreasonable to expect this behaviour, because it is exactly what interfaces are all about, or am I wrong?
That's a pretty reasonable expectation. I think emitting a warning if this doesn't hold would be a sane thing to do, and it wouldn't break any code.