Newbie question: how to determine "is-a" relationship

Robert Roy rjroy at takingcontrol.com
Thu Apr 19 14:00:47 EDT 2001


On Thu, 19 Apr 2001 10:46:53 -0500, "Jake Baker" <jbaker at ummelec.com>
wrote:

>Gosh. I've been using Python since 96 and I don't know this! Wow!
>
>Say I have a class heirarchy that looks like A, B <- A, C <- A, etc....
>
>I have a list of objects (which I know arbitrarily are all A or sublasses =
>of A) and want to filter them based on which subclass they are.
>
>How do I go about doing this? You help is greatly appreciated!
>
>Thanks,
> - Jake Baker
>
>
I think that instanceof will do the trick. See the Python Library
Reference under Built-in Functions (Doc\lib\built-in-funcs.html)

Bob




More information about the Python-list mailing list