osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Python Inheritance Terminology


Irv Kalb <Irv at furrypants.com> writes:

> I'm doing some writing for an upcoming course on OOP using Python.  

Welcome, and congratulations for using Python in this work.

> I'd like to know if there are "official" or even standard terms that
> are used to describe a class that is inherited from, and the class
> that is doing the inheriting. From my reading (especially the PSF
> docs.python.org <http://docs.python.org/>), it looks like the terms
> would be "base class" and "subclass".

Standard (?official?) terms are most likely to be had from the language
reference <URL:http://docs.python.org/3/reference/>. I would recommend
the glossary <URL:http://docs.python.org/3/glossary.html>, but with the
caveat that many flaws have been found in recent years.

> However, in books about Python and other languages, I have also seen the terms:
>
> base class & derived class
> parent class & child class
> superclass & subclass

The only term I take issue with there is ?superclass?. In a
multiple-inheritance system, such as provided by Python, the superclass
is *not* necessarily the base class. See this article from 2011
<URL:https://rhettinger.wordpress.com/2011/05/26/super-considered-super/>.

> So, are base class & subclass the proper terms?

In my opinion you will be correct to use those terms. Which is not to
say that other terms aren't also good.

-- 
 \        ?The greatest tragedy in mankind's entire history may be the |
  `\       hijacking of morality by religion.? ?Arthur C. Clarke, 1991 |
_o__)                                                                  |
Ben Finney