Pythonic Abstract Base Class / Interface

Fredrik Lundh fredrik at pythonware.com
Tue Oct 28 14:57:37 EST 2003


Bruno Desthuilliers wrote:

> > So, as I see it I could:
> > a) create a base class with stubs for all the interface and derive from that.
> > b) create an empty base class and derive from that.
> > c) just make the concrete classes directly with no inheritance commonality.
> >
> > Is there a clear pythonic way, or does it depend a bit more on the
> > design of the specific program?
>
> c), unless you have a compelling technical reason -> then a) with
> NotImplementedErrors or like... I cannot see what's the b) option would
> buy you anyway.

isinstance

</F>








More information about the Python-list mailing list