find an object ancestor
Michel Perez
opsbat at infomed.sld.cu
Wed Nov 5 22:40:30 EST 2008
Thanks it works OK
On Thu, 2008-11-06 at 13:14 +1000, James Mills wrote:
> On Mon, Nov 3, 2008 at 7:16 AM, Michel Perez <opsbat at infomed.sld.cu>
> wrote:
> > 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(son, Father)
> True
> >>> isinstance(son, Son)
> True
> >>> son.__class__.__bases__
> (<class '__main__.Father'>,)
> >>>
>
> --JamesMills
>
---------------------------------------
Red Telematica de Salud - Cuba
CNICM - Infomed
More information about the Python-list
mailing list