Identify object class

N

Nicolas Fleury

Hi,
How do we quickly identify in Python if an object is of a specific
class *or* is of a class deriving directly or indirectly from that class?

BTW, don't you think this newsgroup has a lot of activity and it should
be time to make other newsgroups like comp.lang.python.windows, etc?

Thx and Regards,

Nicolas Fleury
 
C

Carl Banks

Nicolas said:
Hi,
How do we quickly identify in Python if an object is of a specific
class *or* is of a class deriving directly or indirectly from that class?


You want the isinstance built-in function. Example:

if isinstance(obj,cls): do_whatever()

BTW, don't you think this newsgroup has a lot of activity and it should
be time to make other newsgroups like comp.lang.python.windows, etc?


Good idea! I propose the following:

comp.lang.python.misc
comp.lang.python.gui
comp.lang.python.networking
comp.lang.python.dev
comp.lang.python.lisp-envy


--
CARL BANKS http://www.aerojockey.com/software

As the newest Lady Turnpot descended into the kitchen wrapped only in
her celery-green dressing gown, her creamy bosom rising and falling
like a temperamental souffle, her tart mouth pursed in distaste, the
sous-chef whispered to the scullery boy, "I don't know what to make of
her."
--Laurel Fortuner, Montendre, France
1992 Bulwer-Lytton Fiction Contest Winner
 
T

Terry Reedy

BTW, don't you think this newsgroup has a lot of activity and it should
be time to make other newsgroups like comp.lang.python.windows, etc?

The volume goes up and down, I believe (through probably trending up).
The last two weeks have been up withthe x lisp threads.

The idea of division has come up occasionally for several years, but
never any agreement on what the split might be. Also, there are about
50 specialized Python mailing lists. Go to news.gmane.org which
gateways lists to its own newsgroups and look as gmane.comp.python.*.

Terry J. Reedy
 

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

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top