I have some code which I would like to pass instances or classes interchangeably. All I will do in that code is to call a method that I expect both classes and instances to
How about something like:
import inspect class A(object): @staticmethod def go(obj): if inspect.isclass(obj): print 'class' else: print 'instance' A.go(int) # class A.go(1) # instance A.go(A) # class A.go(A()) # instance