I was wondering how to check whether a variable is a class (not an instance!) or not.
I've tried to use the function
class Foo: pass
isinstance(Foo, **???**) # i want to make this return True.
Even better: use the
>>> import inspect >>> class X(object): ... pass ... >>> inspect.isclass(X) True >>> x = X() >>> isinstance(x, X) True >>> y = 25 >>> isinstance(y, X) False