Re: Interfaces != Multiple Inheritance [was Re: python development practices?]
by Graham Ashton other posts by this author
Oct 31 2001 11:47AM messages near this date
Re: python development practices?
|
Re: python development practices?
In article <mailman.1004520094.4879.python-list@[...].org> , "Luigi
Ballabio" <ballabio@[...].com> wrote:
> At 06:35 PM 10/30/01 -0800, Paul Rubin wrote:
> >The idea is implement an abstract base class instead of an interface.
> >Define methods for all the operations you want your interface to
> >support, and make each method simply raise NotImplementedError.
>
> Why would you want to do that in Python?
Imagine that you're writing a library that is to be used by others. Yes,
you've documented it, but they've not read it in full, or quite understood
it yet. They try and use part of your library but don't realise they need
to define some other method in order to sub class one of your classes
correctly.
They can either get an exception that says "no such attribute" or they can
get an exception saying "this thing isn't implemented". I'd suspect
immediately that I'd missed something in the later case and head off to
the docs.
--
Graham
--
http://mail.python.org/mailman/listinfo/python-list
Thread:
Peter Wang
Peter Hansen
Toby Dickenson
Tim Peters
Steve Holden
Steve Holden
Cliff Wells
Tim Peters
Martijn Faassen
Cliff Wells
Cliff Wells
Martijn Faassen
Martijn Faassen
Paul Rubin
Russell E. Owen
Barry A. Warsaw
Martijn Faassen
Peter Wang
Skip Montanaro
John Roth
David Bolen
Peter Wang
Peter Wang
Skip Montanaro
Chris Tavares
Darren Collins
David Bolen
Paul Rubin
Paul Rubin
Peter Wang
F Basegmez
Richard Jones
Richard Jones
Neal Norwitz
Graham Ashton
Peter Wang
Russell E. Owen
Skip Montanaro
Cliff Wells
Hung Jung Lu
Wade Leftwich
Peter Wang
Peter Wang
Peter Wang
Chris Gonnerman
Paul Rubin
Andrew Dalke
Paul Rubin
Luigi Ballabio
Paul Rubin
Tim Peters
John Roth
Paul Rubin
Richard Jones
|