Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Identify object class

Reply
Thread Tools

Identify object class

 
 
Nicolas Fleury
Guest
Posts: n/a
 
      10-14-2003
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


 
Reply With Quote
 
 
 
 
Carl Banks
Guest
Posts: n/a
 
      10-14-2003
Nicolas Fleury wrote:
> 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
 
Reply With Quote
 
 
 
 
Terry Reedy
Guest
Posts: n/a
 
      10-14-2003

"Nicolas Fleury" <(E-Mail Removed)_remove_the_> wrote in message
news:niXib.92072$(E-Mail Removed)...

> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mechanism to identify calling object/method? Nedron Java 5 07-06-2011 12:26 PM
Clean ways to identify derived class types. JC C++ 5 07-05-2009 03:50 PM
How to identify whether a function is module scoped function orstatic method of a class by using its fully qualified name srinivasan srinivas Python 0 07-02-2008 10:32 AM
Nested Class, Member Class, Inner Class, Local Class, Anonymous Class E11 Java 1 10-12-2005 03:34 PM
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM



Advertisments