How to determine if the variable is a function in Python?
        Posted  
        
            by bodacydo
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by bodacydo
        
        
        
        Published on 2010-03-17T01:22:44Z
        Indexed on 
            2010/03/17
            1:31 UTC
        
        
        Read the original article
        Hit count: 622
        
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.
© Stack Overflow or respective owner