[Zope-dev] New-style ExtensionClasses (Zope 2.8) -- MRO issue

Jim Fulton jim at zope.com
Fri Oct 31 13:41:38 EST 2003


Jeremy Hylton wrote:
>>I am worried enough about breaking products that I'm inclined to go
>>with option 3.
>>
>>Does anybody think we ought to use the new algorithm (option 2)?
> 
> 
> I think we should use the new algorithm.  However, I don't have any
> products that I would be responsible for updating and maintaining.  I'd
> be happy to help people work out problems, though.

Ooooohkay.  If anyone has a problem, I'll send them to you and Sidnei. :)

Note that, in many cases, the people having problems will *not* be the
product authors. They'll be people who just want to upgrade thier Zope
installationa that use third-party products.

Oh, and as you help people fix these products, you'll want to redistribute the
fixed products so as to avoid having to fix them over and over.

...

> If we stick with a non-standard MRO, then Zope programmers will have to
> learn special rules for dealing with multiple inheritance with Zope code
> that don't apply to Python programming in general. 

Well, except that they are the same rules used for classic classes, which
probably still predominate in the Python world.


 > I don't see much
> value in creating such a special case here.
> 
> We'd also need to implement our own MRO, maintain it, make sure it's
> correct, etc.  That's a long-term maintenance burden,

That's not a big deal. Options 1 and 3 both have simple algorithms that
are easy to implement and won't really need much maintanance. Fortunately,
type actually provides a hook for overriding the mro computation that makes
this easy.


 > as opposed to a
> short-term problem of updating existing code. 

It won't be that short term. It will come up each time someone wants to
use a product that hasn't been converted before.

 > We can write tools to
> help people update their code if it ends up being a real problem,

I think you are underestimating the complexity of the analysis.

 > and they get clearer code as an added bonus.

I don't think it makes the code any clearer.  Zope 2 has an extremely
complex inheritence graph.  Changing the mro algorithm won't change that.

Zope 3, of course, makes much less use of inheritence and has clearer
code.  It also uses new-style classes and, thus, uses the new algorithm.

I personally don't like the new algorithm, but I don't really care
in the long run. One should avoid inheritence complex enough to show
a difference.

Jim


-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org




More information about the Zope-Dev mailing list