A 'foolproof' way to query inheritance tree?numbers.Real in 2.6)

Discussion in 'Python' started by pythonlist.calin79@spamgourmet.com, Apr 11, 2010.

  1. Guest

    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
     
    , Apr 11, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stub

    B tree, B+ tree and B* tree

    Stub, Nov 12, 2003, in forum: C Programming
    Replies:
    3
    Views:
    10,235
  2. Curious Trigger
    Replies:
    2
    Views:
    1,852
    Curious Trigger
    Sep 9, 2006
  3. Chris Rebert
    Replies:
    3
    Views:
    299
    Chris Rebert
    Apr 13, 2010
  4. Paul Mckibbin
    Replies:
    5
    Views:
    181
    Aldric Giacomoni
    Jan 15, 2010
  5. Replies:
    4
    Views:
    261
    Arne Vajh?j
    Apr 4, 2013
Loading...

Share This Page