How to find the classname of an object? (was Python Documentation)

Heiko Wundram heiko.wundram at ceosg.de
Fri May 13 03:15:21 EDT 2005


On Friday 13 May 2005 03:11, Bengt Richter wrote:
>  >>> type(obj).mro()
>
>  [<class '__main__.A'>, <class '__main__.B1'>, <class '__main__.B2'>,
> <class '__main__.C'>, <type 'object'>]
>

Wow! No need to write a depth-first tree-traversal algorithm... Somebody add 
this idiom to the cookbook.

--- Heiko.



More information about the Python-list mailing list