Why would I use inspect.isclass()?

Nicolas Fleury nid_oizo at yahoo.com_removethe_
Thu Dec 30 09:50:26 CET 2004

it's me wrote:
> Okay, Nick, I didn't know you can pass a "Class" rather then an instance.  I
> have to chew on what your example does.
> But no, I want to pass an instance of a Class.  But how do I know that the
> calling routine *did* pass me a class - pardon me: an instance of a Class?

You have the builtin function isinstance:

class A: pass
a = A()
print isinstance(a, A)  # True


More information about the Python-list mailing list