testing for class of instance

Costas Menico costas at meezon.com
Sun May 13 06:00:27 CEST 2001


Albert Wagner <alwagner at tcac.net> wrote:

>How do I test for the class of an instance?  e.g., I used to test for a 
>dictionary:
>
>if type(aContainer) == type({}):
>
>However, this seems awkward and wasteful.


if isinstance(Foo,ClassFoo):

Costas



More information about the Python-list mailing list