interactive help on the base object

Alan Bawden alan at scooby-doo.csail.mit.edu
Mon Dec 9 02:31:00 EST 2013


Steven D'Aprano <steve at pearwood.info> writes:

> - If all classes are part of a single hierarchy, it must logically end at 
> one (or more, if you support multiple inheritance, which Python does) 
> bases classes. (Unless there are loops, which are generally prohibited in 
> all OOP systems I know of). The simplest way to do this is with a single 
> base class.

The original Lisp Machine "Flavors" system (one of the ancestors of the
Common Lisp Object System) allowed inheritance to be an arbitrary
directed graph -- possibly with cycles.

I don't believe that this was done for any deep principled reason, but
rather it was just permitted because the algorithm for computing method
resolution order didn't actually care whether there were inheritance
cycles -- it still terminated and returned an ordered list of component
classes.

I do not remember seeing any code that made use of this ability, so
don't ask me if it was good for anything, but it was definitely there...

-- 
Alan Bawden



More information about the Python-list mailing list