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. Advertisements

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. Jeremy Pyle

    Re: Representation of real numbers

    Jeremy Pyle, Jun 27, 2003, in forum: VHDL
    Replies:
    1
    Views:
    1,402
    Ken Smith
    Jun 27, 2003
  2. Jim Lewis

    Re: Representation of real numbers

    Jim Lewis, Jul 1, 2003, in forum: VHDL
    Replies:
    0
    Views:
    2,027
    Jim Lewis
    Jul 1, 2003
  3. senthil
    Replies:
    5
    Views:
    1,740
    senthil
    Jan 24, 2004
  4. Stub

    B tree, B+ tree and B* tree

    Stub, Nov 12, 2003, in forum: C Programming
    Replies:
    3
    Views:
    10,598
  5. Curious Trigger
    Replies:
    2
    Views:
    2,125
    Curious Trigger
    Sep 9, 2006
  6. Chris Rebert
    Replies:
    3
    Views:
    354
    Chris Rebert
    Apr 13, 2010
  7. Paul Mckibbin
    Replies:
    5
    Views:
    326
    Aldric Giacomoni
    Jan 15, 2010
  8. Replies:
    4
    Views:
    357
    Arne Vajh?j
    Apr 4, 2013
Loading...