python interfaces

r.grimm at science-computing.de r.grimm at science-computing.de
Sun Jan 6 02:31:02 EST 2008


On Jan 4, 6:01 pm, Sion Arrowsmith <si... at chiark.greenend.org.uk>
wrote:
> hyperboreean  <hyperbore... at nerdshack.com> wrote:
> >Why doesn't python provide interfaces trough its standard library?
>
> Because they're pointless. Java interfaces are a hack around the
> complexities of multiple inheritence. Python does multiple
> inheritence Just Fine (give or take the subtleties of super()) so
> does not need them.
>
Hallo,
Interfaces are a extremly smart Design Principle in static typed
languages
like Java and C++.
C++ support Interfaces in a form of abstract base classes. They aren't
pointless.
They force the user of a framework to use it in a defined way. You
prescribe in
the base class the usage of a classsystem and allow only in derived
classes
to variate the behavior.
To appreciate Interfaces look at  the Template Methode Pattern (http://
en.wikipedia.org/wiki/Template_method_pattern )
or especially at the Non Virtual Interface ( http://www.gotw.ca/publications/mill18.htm
) Idiom from Herb Sutter.

To be short C++ support Interfaces and multiple inheritace.

Greetings  Rainer



More information about the Python-list mailing list