Re: find an object ancestor

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • James Mills

    Re: find an object ancestor

    On Mon, Nov 3, 2008 at 7:16 AM, Michel Perez <opsbat@infomed .sld.cuwrote:
    HI all:
    >
    imagine something like this:
    >
    class father:
    pass
    class son( father ):
    pass
    >
    I need to know the son ancestor class how can i know this.
    >>class Father(object): pass
    ....
    >>class Son(Father): pass
    ....
    >>son = Son()
    >>isinstance(so n, Father)
    True
    >>isinstance(so n, Son)
    True
    >>son.__class__ .__bases__
    (<class '__main__.Fathe r'>,)
    >>>
    --JamesMills

    --
    --
    -- "Problems are solved by method"
Working...