[Types-sig] Interface PEP

Michel Pelletier michel@digicool.com
Thu, 15 Mar 2001 13:53:38 -0800 (PST)


On Thu, 15 Mar 2001, Paul Prescod wrote:

> Michel Pelletier wrote:
> >
> > On Wed, 14 Mar 2001, Paul Prescod wrote:
> >
> > > I've come to think that there is a difference between what Michel calls
> > > __implementedby__ and what I now call __check__
> >
> > Just an aside, I don't call anything __implementedby__, I propose
> > __implements__.  I think the former is semanticly ambiguous.
>
> You have isImplementedBy.

Yes, it's not ambiguous in that case <wink>.  Keep in mind,
isImplementedBy does not try to "check" anything about the object you pass
it other than it defines an __implements__ and the interface finds itself
in that assertion.  There is no rigorous checking to make sure the object
isn't lying.  This is a feature.

> But built-in Python features do not use
> camelcase and methods that are magically invoked are typically __
> prefixed.

You lost me, isImplementedBy is not magically invoked.  You have to
specificly ask:

FooInterface.isImplementedBy(fooObject)

__implements__ on the other hand, is supposed to be the interface analog
to __bases__.

-Michel