Testing for is-kind-of relationships (at runtime)
Alain Desilets
Alain.Desilets at nrc.ca
Fri Jan 19 08:09:17 EST 2001
Thanks.
Fredrik Lundh wrote:
> Alain Desilets wrote:
> > For example, suppose x is an instance of A which is a subclass of B
> > which is a subclass of C. I want to be able to ascertain at run time
> > that x is a descendant of class C.
>
> assert isinstance(x, C)
>
> Cheers /F
--
Alain Désilets
Research Officer
National Research Council Canada
Institute for Information Technology
Agent de recherche
Conseil national de recherche Canada
Institut de technologies de l'information
email/courriel: alain.desilets at iit.nrc.ca
---
Arguing with an engineer is like mud wrestling with a pig.
You soon realize you both enjoy it.
---
More information about the Python-list
mailing list