Question about subclassing - version 2

Frank Millman frank at chagford.com
Fri Sep 8 04:05:27 EDT 2006


bearophileHUGS at lycos.com wrote:
> Frank Millman, just a short note, more expert people can give you
> better answers. There aren't abstract classes in Python. They are all
> concrete. You may have classes with undefined methods (they may raise
> NotImplementedError).
> Multiple inheritance isn't supported by Java and Ruby, but it is
> supported by C++ and Python, so you can use it in Python.
> There are also ways of mixing methods. You may define methods, and then
> lists of methods to add to your classes.
>
> Bye,
> bearophile

I use the term 'abstract class' in the abstract sense :-)

Say I have three classes where 90% of the attributes and methods are
common. It makes sense to create a base class with these attributes and
methods, and turn each of the three classes into a subclass which
inherits from the base class and overrides the bits that are unique to
each one.

This is what I call an abstract class. Maybe there is a more correct
term.

Frank




More information about the Python-list mailing list