What is the class of myobj?

JXStern JXSternChangeX2R at gte.net
Tue Oct 15 20:36:39 EDT 2002


I want to write something like:

If ClassOf(myobj) == "MyClass": print "OK!"
  or
If ClassOf(myobj) == MyClass: print "OK!"   # no quotes on class

The best I've found in Python is based on str(myobj.__class__).

What's the official way?

Thanks.

Newbie still,
Joshua Stern





More information about the Python-list mailing list