I was wondering how to check whether a variable is a class (not an instance!) or not.
I\'ve tried to use the function isinstance(object, class_or_type_or_tuple
simplest way is to use inspect.isclass as posted in the most-voted answer.
the implementation details could be found at python2 inspect and python3 inspect.
for new-style class: isinstance(object, type)
for old-style class: isinstance(object, types.ClassType)
em, for old-style class, it is using types.ClassType, here is the code from types.py:
class _C:
def _m(self): pass
ClassType = type(_C)