[Python-Dev] Is object the most base type? (bpo-20285)

Terry Reedy tjreedy at udel.edu
Fri Feb 2 19:28:24 EST 2018


On 2/2/2018 1:53 AM, Terry Reedy wrote:
>  >>> object.__doc__
> 'The most base type'
> 
> I and several people on python-list thread "interactive help on the base 
> object" (Dec   2013) thought this could be improved.  On
> https://bugs.python.org/issue20285 and
> https://github.com/python/cpython/pull/4759
> 
> After some research, I believe the following, which is wrote on the 
> issue, explains the uneasiness many feel.
> 
> 'Base' is actually two words.  As a noun (or verb), it comes from 
> Ancient Greek βάσις (básis), a foundation from which other things extend 
> or derive.  As an adjective, it comes from Late Latin bassus (“low”).
> 
> In computer science and Python, the couplet 'base class' is being used, 
> it seems to me and apparently others, as a noun-noun compound, meaning, 
> 'foundation class', not as an adjective-noun phrase meaning 'low class' 
> (let along 'depraved class').  However, 'most base class' must be parsed 
> as '(most base) class', with 'base' re-interpreted as the adjective 
> meaning 'low' (or worse).  The switch in meaning of 'base' is similar in 
> 'baseball' versus  'most base ball'.
> ---
> 
> I have suggested
> "The superclass for all Python classes."
> "The starting base class of all types and classes other than itself."

"a base for all classes." object entry in lib ref, function
"the ultimate base class of all other classes."  Martin Panter

object is neither a base or superclass of itself, so the first of each 
pair above is not quite right.

"the base class of the class heirarchy ['hierarchy']"  Steven D'Aprano
"the root of the class heirarchy"  ditto
+ quotes from Java and Ruby

Jeff Allen and Barry Warsaw like either, with BW slightly referring the 
first.

I was thinking about 'tree' instead of 'hierachy', but 'class tree' is 
wrong and 'directed acyclic graph of classes' a bit wordy.  While 
hierarchies are often thought of as trees, it is possible for someone to 
report to more than one person.

No one (yet) supported the status quo.

Martin also suggested a continuation:  "When called, it accepts no
arguments and returns a new unique and featureless object."

Even though object, unlike any other class, is primarily used as a base 
class rather than instance source, the latter should be included.  For 
other built-in classes, the summary line describes instances. I would 
leave out 'unique' as that could be confused with 'singleton'.

Provisional replacement, following the format of other class docstrings 
except for describing the class instead of instances, and intended to be 
helpful to beginners.

"The base class of the class hierarchy.

When called, it accepts no arguments and returns a new featureless 
instance that has no instance attributes and cannot be given any."

Passing arguments and adding attributes are two common mistakes.


-- 
Terry Jan Reedy




More information about the Python-Dev mailing list