[Zope3-Users] Interface confusion (still)

Fred Drake fdrake at gmail.com
Tue Jul 15 23:18:51 EDT 2008


On Tue, Jul 15, 2008 at 7:36 PM, Tim Cook <timothywayne.cook at gmail.com> wrote:
> And in my Maildir example it implements what is defined in IMaildir but
> how does it 'provide' what is in IMaildirFactory?  Specifically the
> __call__ method.

The __call__ of a class is the default constructor (the standard
__new__/__init__ dance).  Static and class methods of the class can
also be used to support the interfaces of the class itself.

> So my continuing thick-headed questions is:  What does classProvides
> really mean from a practical standpoint?  Some kind of use case?

Well, it sounds like you've already identified it as a way to describe
the interface of the class (as a factory).  It's not unusual for code
using the component architecture to locate factories for objects by
looking up a utility that provides the factory interface.  That allows
some nice ways to re-use composition-based constructs.


 -Fred

-- 
Fred L. Drake, Jr. <fdrake at gmail.com>
"Chaos is the score upon which reality is written." --Henry Miller


More information about the Zope3-users mailing list