interactive help on the base object

Alan Bawden alan at scooby-doo.csail.mit.edu
Tue Dec 10 00:34:05 EST 2013


Chris Angelico <rosuav at gmail.com> writes:
> How does that work, exactly? How do you have a class inherit
> (ultimately) from itself, and how does that impact the component class
> list?

How does it work "exactly"?  You're asking me about a feature I never
made use of, in a system I have no source for, and that I haven't used
in over 25 years!  If it wasn't mentioned in a parenthetical comment in
the 32-year-old documentation I still have on my bookshelf (Lisp Machine
Manual, 4th edition, July 1981, blue cover), I wouldn't trust my own
memory that such a thing ever even existed.

So you're not getting anything "exact" here!

I have no idea exactly how it worked, but imagine something that walked
the superclass graph _as_ _if_ it was a tree, collected classes in some
order, and that just skips any class it encounters for the second time.
That results in _some_ linear ordering of all the classes you can reach
from the starting class.  Now use that.

Now the results aren't going to be very good by modern standards.  As
the Common Lisp Object System, Dylan, Python, and others, have all
discovered, you really want something that is at _least_ a topological
sort of the superclass graph -- and there is no topological sort at all
unless your superclass graph is acyclic.

But even if the results aren't up to modern standards, you can write a
hell of a lot of code before the deficiencies have hurt enough people
enough times to motivate you to do better.  After all modern Python
classes didn't start using their current ordering until Python 2.3.

-- 
Alan Bawden



More information about the Python-list mailing list