python interfaces

Peter Maas peter.maas at somewhere.com
Sat Jan 5 15:42:38 EST 2008


Sion Arrowsmith wrote:
> hyperboreean  <hyperboreean at nerdshack.com> wrote:
>> Why doesn't python provide interfaces trough its standard library?
> 
> Because they're pointless.

Wrong. I'm using Eclipse with the Java Development Tools (JDT) who do
a wonderful job using interfaces to perform lots of checking, warning
and code generation *nearly in real time while I am editing my code*.
Because JDT knows interfaces it knows what to do and to suggest.

> Java interfaces are a hack around the complexities of multiple
> inheritence.

A hack is something applied subsequently to solve a software problem while
avoiding large changes. Java interfaces originate from careful language
design. You are free to dislike Java interfaces but calling them a hack is
just plain wrong.

Once software becomes really big interfaces are very useful to handle
complexity. Ever wondered why the Zope people introduced interfaces in
their Python code?

> Interfaces used purely with the idea of type safety provide
> precious little gain for the added clutter and inconvenience.

An interface is a software specification allowing you to use a software
package without extensive code studies. This is a good thing. Interfaces
have nothing to do with multiple inheritance and are not about type safety
in the first place. They just tell you how to connect, how to plug in.

-- 
Regards/Gruesse,

Peter Maas, Aachen
E-mail 'cGV0ZXIubWFhc0B1dGlsb2cuZGU=\n'.decode('base64')



More information about the Python-list mailing list