[Interface-dev] module-level interface

John Lenton jlenton at gmail.com
Thu Jun 9 02:47:13 EDT 2005


Well, this is what I came up with. It works for me, but I can't get
the testing framework to work so it's untested outside of my own use
case. What I've done is made it so that interfaces can contain other
interfaces, which is then used by verifyObject to check that the
object being verified contains an object that implements that
interface.

Thus, in interfaces.py:
  class IWindow(Interface): pass
  class ISkin(Interface):
    Window = IWindow
and in the skin:
  class Window(Container):
    implements(IWindow)
and in the skin loader:
  skin = __import__(blah)
  verifyObject(skin) # passes

I guess that interpreting an interface to mean an object implementing
it (instead of providing it) is arbitrary and I should've written a
couple of classes similar to the existing Attributes, right? Except
that ... well, it works for me, and YAGNI, and all that.

And now, the patch.

-- 
John Lenton (jlenton at gmail.com) -- Random fortune:
Don't anthropomorphise computers and cars, They hate that.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: interfaces_have_interfaces.patch
Type: text/x-patch
Size: 1539 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/interface-dev/attachments/20050609/b456bb42/interfaces_have_interfaces.bin


More information about the Interface-dev mailing list