durusmail: quixote-users: Python Interfaces
Resend: Re: quixote: next step
Re: quixote: next step
2000-10-25
Re: quixote: next step
2000-10-25
2000-10-25
Re: quixote: next step
2000-10-26
2000-10-26
2000-10-26
Python Interfaces
2000-12-04
2000-12-04
Python Interfaces
Michel Pelletier
2000-12-04
On Mon, 4 Dec 2000, Greg Ward wrote:

> On 03 December 2000, Michel Pelletier said:
> > Been doing lots of work on the Python Interfaces proposal.
>
> I'll say!  What I've read so far is interesting.

Thanks.

> > For a good, high-level introduction to this package, read the user
> > documentation in the Wiki:
> >
> > http://www.zope.org/Wikis/Interfaces/InterfaceUserDocumentation
>
> This is what I've been reading.  Some random, off-the-top-of-my-head
> comments:
>
>   * isn't the type of an attribute interesting?  I don't see that
>     mentioned anywhere, and this is something I consider critical
>     (especially for persistent objects!)

Many different types may implement the same interface, so I don't
think it would be useful to assert a type in the interface.  Of
course, as an application specification you may *require* only one
type implement an interface; in that case you can tag the interface
with a 'type' value and do your own checks:

class FooInterface(Interface.Base):
  """ blah blah """

  def aMethod(self):
    """ blah blah """

class Foo:

  __implements__ = FooInterface,

  def aMethod(self):
    print 'barf!"

FooInterface.setTaggedValue('type', type(Foo()))

>   * in a few spots, you speak of a class "realizing" an interface.
>     Is this the same as "implementing" an interface?  If so,
>     why not use the same terminology; if not, what's the difference?

they are synonymous, I'll switch it all to 'implements'.

Thanks!

-Michel



reply