[Python-3000] Abilities / Interfaces
Phillip J. Eby
pje at telecommunity.com
Thu Nov 23 20:12:50 CET 2006
At 10:53 AM 11/23/2006 -0800, Guido van Rossum wrote:
>On 11/22/06, Thomas Lotze <thomas at thomas-lotze.de> wrote:
> > Guido van Rossum wrote:
> >
> > >> I'm sure you're aware about it, but in Zope 3 terminology, these are
> > >> 'provide' and 'implement', respectively.
> > >
> > > I like provide, but I'm not so sure about implement, since it is awfully
> > > ambiguous -- most of the time it is the class that does the implementing.
> > > That's why I settled for "has".
> >
> > JFTR: In Zope3, classes "implement" interfaces while instances "provide"
> > them.
>
>Well, that pretty much proves their terminology is confusing. :-)
You can actually blame that one on me; I'm the one who proposed it. :)
At the time, mailing list discussions were hard to follow as to whether we
were talking about instances or classes when we were talking about
"implements". So I suggested that we add "provide" to mean that you could
actually *use* the interface on the object, and leave "implements" to mean
that your *instances* provide the interface.
The distinction helped the immediate discussion, but later, when I went on
to create PyProtocols, I realized it wasn't as clear outside the original
context, so I stopped talking about 'implements' entirely and just always
used 'provides' instead. So, instead of saying that a class "implements"
X, PyProtocols says that a class' *instances* provide X, and you declare
this with 'instancesProvide'. If the class *itself* provides the interface
(e.g. via classmethods), you declare it with 'classProvides'.
So, I think the "provide" term was a good idea, it's just that having a
different word to mean "my instances provide", didn't work out for me.
More information about the Python-3000
mailing list