#quote#
Dan Bullok wrote in message ...
Mike C. Fletcher wrote:
> You can find more information about these kinds of patterns by searching
> for "Mix-In Class" and/or "Multiple Inheritance". Python 2.2 changed how
> multiple inheritance graphs are constructed in Python, BTW. If you used
> old-style classes the mro would have been [MySub, Sub, Base, MyBase, Base]
> IIRC.
Well, I thought of doing this, but after looking up resolution order (sec
9.5.1 of the tutorial) I found that resolution is done "depth-first,
left-to-right", In my example, that would have given [MySub, Sub, Base,
MyBase, Base], but, I checked, using mro(), and found that it was indeed
[MySub, Sub, MyBase, Base], just as I needed it. (thanks for the mro() tip
- didn't know about that one). Unless I've gone crosseyed (possible, it's
late), this is NOT depth-first, left-to-right. So is the tutorial out of
date?
#endquote#
I just looked and, yes indeed, it is out of date (file a bug report).
Python 2.2 used this mro, which was changed in 2.3. 2.3 uses a so-called
'C3' mro, which is a bit more complex. See
http://www.python.org/2.3/mro.html.
The best documentation on Python classes WRT the new-style changes is an
essay by Guido at
http://www.python.org/2.2.2/descrintro.html. It says 2.2,
but it mentions 2.3 changes as inline addendums.
Odd thing is, filename is "descriptor intro" yet it doesn't mention
descriptors. There's a good reference on the madness that is descriptors at
http://users.rcn.com/python/download/Descriptor.htm.
--
Francis Avila