callable() tells if an object can be invoked via the function operator (). : callable « Buildin Function « Python Tutorial






# It returns True if the object is callable and False otherwise

print callable(dir)              # built-in function
print callable(1)                # integer

def foo(): pass

print callable(foo)              # user-defined function
print callable('bar')            # string

class C(object): pass
print callable(C)                # class








13.5.callable
13.5.1.callable() tells if an object can be invoked via the function operator ().
13.5.2.callable function returns True if the object can be called