PEP 245
Alex Shindich
alex at server01.shindich.com
Sun Apr 1 19:29:54 EDT 2001
On Sun, 1 Apr 2001, Carlos Alberto Reis Ribeiro wrote:
> I'm not the best person to answer you, but that's my take. Interfaces allow
> for some very powerful forms of OO abstraction to be implemented. You
> aren't forced to use inheritance for everything. This frees the class
> hierarchies, making it possible to have a "mesh" of classes instead of a
> very rigid tree structure. It also tends to minimize the use of multiple
> inheritance, when all that you want is to support multiple interfaces. All
> of this is possible even without static typing. As for your concern with
> the semantics, no strongly typed language can enforce it - you have just to
> hope that the function being called behaves as documented.
>
I do not want to restart the whole discussion on the difference between
base classes and interfaces, but I am of the opinion that they both
represent an is-a relationship.
> >2. At what point will the compliance with the interface definition be
> >done, at compile time, or at run time?
>
> Don't know what the dev guys are thinking. I would prefer *not* to
> explicitly check interface compliance at any time. You said that you
> supported a interface, it's your job to write the methods for it. If you
> don't do so, you get an exception.
>
Arguably, this behavior is already available through runtime method
binding.
> But I think that is reasonable for
> any language developer to borrow stuff from other languages. People has
> been doing this for a long time anyway <wink>.
I agree that borrowing best practices from other languages is a great
idea. In fact, interfaces make Java very powerful. I just don't think that
interfaces will be as useful for Python.
> Also note that, by
> supporting a runtime (on-demand) approach to interface checking, we are
> keeping with Python tradition.
This makes interfaces to be as good as doc strings...
--
Alex Shindich
mailto:alex at shindich.com
Visit http://www.shindich.com/
More information about the Python-list
mailing list