Are there 'Interfaces' in Python??

tszeto tszeto at mindspring.com
Wed Sep 26 00:08:50 EDT 2001


Yes. I like interfaces. Very helpful. I like interfaces. Yes.


"Richard Jones" <richard at bizarsoftware.com.au> wrote in message
news:mailman.1001472149.684.python-list at python.org...
> On Wednesday 26 September 2001 11:50, Paul Rubin wrote:
> > "tszeto" <tszeto at mindspring.com> writes:
> > > Was wondering if Python supported 'Interfaces' (something akin to Java
> > > interfaces)? Or if there's a workaround to get the same thing.
> >
> > Java interfaces are a workaround for java's non-support of multiple
> > base classes in objects.  Python supports multiple base classes, so
> > it doesn't need a workaround for their absence.
>
> Er, no. They may be percieved as that, but since interfaces can't actually
> _do_ anything, whereas multiple inheritance _can_, I believe this is a
dead
> herring.
>
> Interfaces are an extremely useful form of "type" checking for OO systems.
> Python already has "interfaces" in the form of agreed methods - witness
the
> "pass a file-like object" requirements in a lot of APIs. An interface
would
> just formalise that.
>
> There are proposals for interfaces floating around - I believe the Python
> Enhancement Proposal 245 is gaining popularity.
>
>    "Python Interface Syntax"
>    http://python.sourceforge.net/peps/pep-0245.html
>
>
>       Richard
>





More information about the Python-list mailing list