interactive help on the base object

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Dec 8 11:33:32 CET 2013


On Sat, 07 Dec 2013 20:21:06 -0800, Mark Janssen wrote:

>>>> Is it just me, or is this basically useless?
>>>>
>>>> class object
>>>>  |  The most *base* type
>>>
> [[Terry Reedy:]]
>> How about something like.
>> The default top *superclass* for all Python classes.
> 
> How 'bout you foo<l>s just admit that you didn't realize you've been
> confused this whole time?  (It *is* possible isn't it?)
>
> Mr. Ewing says "base" has to be interpreted as an *adjective* because
> otherwise it would mean the BOTTOM (like the BASE of the pyramid), while
> Terry responds that it is the TOP (*super*class).  Earlier, Steven
> D'Aprano wanted to argue that this distinction was irrelevant, 

What are you talking about? Until this very post, I haven't made any 
comments in this thread. 


> but obviously it can't very well be both at once now cannit?

Of course it can. To people in the southern hemisphere, the South Pole is 
at the top of the world and the North Pole is at the bottom. For people 
in the northern hemisphere, it's the opposite, with the North Pole being 
"up" and the South Pole being "down".

http://cdn.shopify.com/s/files/1/0071/5032/products/upside_down_world_map.png


Family trees and other hierarchies, including class inheritance diagrams, 
have a *relative* direction not an absolute direction. We can all agree 
that Fred and Wilma are the parents of Pebbles, but it doesn't really 
matter whether we draw the family tree like this:


Fred      Wilma              (diagrams best viewed in a fixed-width font
  |         |                 like Courier, Monaco or Lucinda Typewriter)
  +----+----+
       |
    Pebbles


(inheritance goes *down* the page from ancestors to descendants)

or like this:

    Pebbles
       |
  +----+----+
  |         |
Fred      Wilma


(inheritance goes *up* the page from ancestors to descendants).

What matters is the relationships between the entities, not the specific 
direction they are drawn in relative to some imaginary absolute space. 
Likewise it doesn't matter whether we draw class hierarchies from the top 
down or the bottom up or even sidewise:

object --> int --> myint

is the same as:

myint <-- int <-- object


Ironically, although it is conventional to draw the most distant ancestor 
at the *top* of the page, it is called the *base* or *root* of the tree.


This Way Up
    ||
    ||
    ||
  \ || /
   \||/





-- 
Steven




More information about the Python-list mailing list