En Sun, 25 May 2008 13:32:39 -0300, Paul McGuire <[EMAIL PROTECTED]> escribió:
> Here's a more general version of your testing code, to detect *any* > diamond multiple inheritance (using your sample classes). > > for cls in (A,B,C,D): > seen = set() > try: > bases = cls.__bases__ > for b in bases: > if hasattr(b,"__mro__"): > for m in b.__mro__: > if m in seen: > raise Exception("diamond multiple > inheritance") > seen.add(m) > except Exception, e: > print cls,"has diamond MI" > else: > print cls,"is ok" I think you should exclude the `object` class from the test, because all new-style classes inherit from it and *every* case of multiple inheritance forms a diamond. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list