faqts : Computers : Programming : Languages : Python : Language and Syntax : Classes

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

54 of 63 people (86%) answered Yes
Recently 10 of 10 people (100%) answered Yes

Entry

How can I get the class of an object instance?
What are some functions to help me use classes in Python?

Feb 29th, 2000 20:51
Nathan Wallace, Fredrik Lundh, John Lehmann


These two functions might help you to play with classes:

  isinstance (object, class) 
  issubclass (class1, class2) 

There is also a __class__ attribute

  someObject.__class__

for more info, see:

  http://www.python.org/doc/current/ref/types.html
  http://www.python.org/doc/current/lib/specialattrs.html