473,218 Members | 1,443 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,218 software developers and data experts.

python interfaces

Hi,
Probably it has been asked before, but I'll still ask.
Why doesn't python provide interfaces trough its standard library? Or it
was ever proposed to be included in the language?
Zope's implementation seems pretty flexible and straightforward.

Thanks.

Jan 4 '08 #1
10 1960
On Jan 4, 3:59 pm, hyperboreean <hyperbore...@nerdshack.comwrote:
Hi,
Probably it has been asked before, but I'll still ask.
Why doesn't python provide interfaces trough its standard library? Or it
was ever proposed to be included in the language?
Zope's implementation seems pretty flexible and straightforward.

Thanks.
Python 3.0 will introduce Abstract Base Classes:

http://www.python.org/dev/peps/pep-3119/
Jan 4 '08 #2
hyperboreean <hy**********@nerdshack.comwrote:
>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.

Interfaces used purely with the idea of type safety provide
precious little gain for the added clutter and inconvenience.
Compare them to Java's requirement for explicit declaration of
exceptions thrown in a method signature, if you will.

--
\S -- si***@chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
"Frankly I have no feelings towards penguins one way or the other"
-- Arthur C. Clarke
her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
Jan 4 '08 #3
Sion Arrowsmith wrote:
hyperboreean <hy**********@nerdshack.comwrote:
>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. An
interface is a software specification allowing you to use a software
package without extensive code studies. This is a good thing.
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. They just tell you how to
connect, how to plug in.

--
Regards/Gruesse,

Peter Maas, Aachen
E-mail 'cGV0ZXIubWFhc0B1dGlsb2cuZGU=\n'.decode('base64')
Jan 5 '08 #4
Sion Arrowsmith wrote:
hyperboreean <hy**********@nerdshack.comwrote:
>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')
Jan 5 '08 #5
On Jan 4, 6:01 pm, Sion Arrowsmith <si...@chiark.greenend.org.uk>
wrote:
hyperboreean <hyperbore...@nerdshack.comwrote:
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
Jan 6 '08 #6
r.*****@science-computing.de wrote:
Interfaces are a extremly smart Design Principle in static typed
languages like Java and C++.
that's somewhat questionable in itself, and even more questionable as an
argument for interfaces in Python.

I'd recommend anyone who thinks that they cannot program without formal
interfaces to try using Python as Python for a while, before they try
using it as something else. you might be surprised over how easy it is
to build robust stuff without having to add lots of extra constraints to
your code.

</F>

Jan 6 '08 #7
On Sat, 05 Jan 2008 23:31:02 -0800, r.grimm wrote:
They force the user of a framework to use it in a defined way.
This is the arrogance of the provider thinking that he can anticipate all
the needs of the user.

Even when interfaces exist, they should be there to guide the user rather
than to force the user. A user should be able to refuse to implement the
interface, if the user knows that full implmentation is not necessary, or
dangerous. Frankly, a lot of interfaces suck. The user is often a lot
smarter than the provider, and nearly always knows his needs better. My
sympathies in these matters are entirely on the user's side--I know
that's very different from the philosophies of languages like C++ and
Java.

There's a time and a place for interfaces. Your average run-of-the-mill
polymorphism is not it. Usually interfaces are more of a burden than a
benefit, especially in code that is young and still subject to lots of
redesign and refactoring.

And ehen interfaces do make sense, such as in a plugin system or a
complex framework, the user should be free to ignore the interface at his
own risk.

Carl Banks
Jan 6 '08 #8
Sion Arrowsmith a écrit :
hyperboreean <hy**********@nerdshack.comwrote:
>>Why doesn't python provide interfaces trough its standard library?


Because they're pointless.
(snip rant about Java's "interfaces")

Hem... Zope3's "interface" system is not exactly the same thing as
Java's one.
Jan 6 '08 #9
On Jan 6, 11:01 am, Fredrik Lundh <fred...@pythonware.comwrote:
r.gr...@science-computing.de wrote:
Interfaces are a extremly smart Design Principle in static typed
languages like Java and C++.

that's somewhat questionable in itself, and even more questionable as an
argument for interfaces in Python.

I'd recommend anyone who thinks that they cannot program without formal
interfaces to try using Python as Python for a while, before they try
using it as something else. you might be surprised over how easy it is
to build robust stuff without having to add lots of extra constraints to
your code.

</F>
Hallo,
I argued, that Interface and multiple inheritance are different
things and
especially, that Interfaces are very useful in staticially typed
languages.
In such languages like Java and C++ you need a formalismen to guide
the user.
You may call it extension point, pure virtual function or abstract
methode.

Sorry for the misunderstanding, I argued for Interface in heavyweight
static
typed languages and nor for lightweight dynamic typed languages like
python.
They aren't pointless and a hack.

Greetings Rainer

Jan 7 '08 #10
Bruno Desthuilliers <bd*****************@free.quelquepart.frwrote:
>Sion Arrowsmith a écrit :
(snip rant about Java's "interfaces")

Hem... Zope3's "interface" system is not exactly the same thing as
Java's one.
Yeah, I was in need of letting off some steam in general and
didn't pay enough attention that what I was ranting about was
on topic. Given that Zope3's "interfaces" are the kind of thing
under discussion, the correct response is obviously Michele's
pointing at the ABC PEP.

--
\S -- si***@chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
"Frankly I have no feelings towards penguins one way or the other"
-- Arthur C. Clarke
her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
Jan 7 '08 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Uwe Mayer | last post by:
Hi, I have come across the following statement a number of times: http://mail.python.org/pipermail/python-list/2003-July/171805.html > Python, in general, doesn't try to stop the programmer...
8
by: Joakim Persson | last post by:
Hello all. I am involved in a project where we have a desire to improve our software testing tools, and I'm in charge of looking for solutions regarding the logging of our software (originating...
3
by: Paul Mc Gee | last post by:
hi everyone i have just downloaded the latest version of postgresql and was doing the installation according to the article at http://www.faqs.org/docs/ppbook/x486.htm when i got to the point...
42
by: redefined.horizons | last post by:
I'm coming from a Java background, so please don't stone me... I see that Python is missing "interfaces". The concept of an interface is a key to good programming design in Java, but I've read...
11
by: san | last post by:
Hi I am using windows xp and have installed python and win32. I am familiar with basic Python. I wanted to control some of the applications via python script. I would like to write a python...
6
by: Christian Convey | last post by:
Hi guys, I'm looking at developing a somewhat complex system, and I think some static typing will help me keep limit my confusion. I.e.: ...
28
by: jmDesktop | last post by:
Studying OOP and noticed that Python does not have Interfaces. Is that correct? Is my schooling for nought on these OOP concepts if I use Python. Am I losing something if I don't use the...
0
by: Roger Ineichen | last post by:
Hi Tim For a usecase like this, I personaly recommend to defina all interfaces in one module which probably is a namespace if you need alot of interfaces to define. e.g. ...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.