Interfaces

John Roth johnroth at ameritech.net
Thu Nov 21 10:38:52 EST 2002


"Martin v. Löwis" <loewis at informatik.hu-berlin.de> wrote in message
news:j4zns3cd1y.fsf at informatik.hu-berlin.de...
> Lee Harr <missive at frontiernet.net> writes:
>
> > Are interfaces still a happening proposition?
>
> If you give it enough time (like 10 years or so), it might happen.
>
> > Did we decide that we are not interested? Or are we waiting to see
> > how this goes in Zope before making any commitment?
>
> Who is that "we" that you are referring to. I'm personally not very
> interested in interfaces as a language feature; I'm just fine with
> interfaces as a concept and documentation vehicle.
>
> What "we" are interested in is irrelevant. To make it happen, you need
> a single individual determined enough to make it happen. That
> individual should be prepared to get holes shot into the first 50
> proposals that she comes up with.
>
> IOW, it hasn't happened yet because it is really difficult.

I suspect part of the problem is that no one has made a really
compelling case yet. If you look at Java's interface implementation,
there are three things it does:

1. It compensates for a serious weakness in single inheritance.
2. It "gets around" the type system by allowing an object to
have several types outside of the standard single inheritance
hierarchy.
3. It allows a method to determine if an object provides the
function it needs.

Only 3 is relevant to Python. Python has multiple inheritance
and does not have static typing. If you use multiple inheritance
instead of interfaces, you can run the class hierarchy to
determine if a particular class is in the inheritance tree.

If you can come up with a really compelling #4, then it might
get done. Until the, I'm not holding my breath.

John Roth

>
> Regards,
> Martin





More information about the Python-list mailing list