grandparent method with super

John Clark clajo04 at mac.com
Thu Apr 5 18:16:04 EDT 2007


> Not really. The first grandparent would be the first occurrence in the
list from left to right, which satisfies the requirement that its shortest
path to the current class is 2.

> The only problem: How do I get it?

> Martin

I suppose you could do a 

    self.__class__.__bases__[0].__bases__[0] 

(With the appropriate error handling buit in..) 

But I am not sure if it's a safe assumption to depend on __bases__ returning
the classes in the order you want...

-jdc 


--
http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list