How to determine if the variable is a function in Python?
- by bodacydo
Since functions are values in Python, how do I determine if the variable is a function?
For example:
boda = len # boda is the length function now
if ?is_var_function(boda)?:
print "Boda is a function!"
else:
print "Boda is not a function!"
Here hypothetical ?is_var_function(x)? should return true if x is a callable function, and false if it is not.
Please advise!
Thanks, Boda Cydo.