Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   A 'foolproof' way to query inheritance tree?numbers.Real in 2.6) (http://www.velocityreviews.com/forums/t720253-a-foolproof-way-to-query-inheritance-tree-numbers-real-in-2-6-a.html)

pythonlist.calin79@spamgourmet.com 04-11-2010 05:46 PM

A 'foolproof' way to query inheritance tree?numbers.Real in 2.6)
 
Generally, if I want to know the inheritance tree of a class, I either
use inspect.getmro or __bases__

However, after reading about the new numbers module / class tower in
Python 2.6/3.0, I realized that both of these will fail to show that
the 'float' type actually inherits from numbers.Real:

>>> import inspect, numbers
>>> issubclass(float, numbers.Real)

True
>>> inspect.getmro(float)

(<class 'float'>, <class 'object'>)
>>> float.__bases__

(<class 'object'>,)

Is there a more foolproof way to query this information? Or is this
simply some sort of bug with the new implementation of numbers in
python 2.6?

- Paul



All times are GMT. The time now is 03:09 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.