How to check for instances of a class

E

erokar

Traversing a list of variables, I need to check wheter an element in
the list is an instance of a (user defined) class. What cind of
comparison operator can I use? Can't seem to find this in the
documentation. I anyone have an example it is much appreciated.
 
D

Dennis Benzinger

On 14 Nov 2006 11:00:53 -0800
Traversing a list of variables, I need to check wheter an element in
the list is an instance of a (user defined) class. What cind of
comparison operator can I use? Can't seem to find this in the
documentation. I anyone have an example it is much appreciated.

Use isinstance() <http://docs.python.org/lib/built-in-funcs.html>.

You need something like


Dennis
 
G

Gabriel Genellina

At said:
Traversing a list of variables, I need to check wheter an element in
the list is an instance of a (user defined) class. What cind of
comparison operator can I use? Can't seem to find this in the
documentation. I anyone have an example it is much appreciated.

isinstance


--
Gabriel Genellina
Softlab SRL

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top