You need to use types.LambdaTypeor types.FunctionTypeto make sure the object is a functional object like this
x = lambda d:d*d
import types
print type(x) is types.LambdaType
print isinstance(x, types.LambdaType)
and then you need to also check the name to make sure that we are dealing with a lambda function, for example
x = lambda x: None
def y(): pass
print y.__name__
print x.__name__
So, we have collected both of these checks, such as
def is_lambda_function(obj):
return isinstance(obj, types.LambdaType) and obj.__name__ == "<lambda>"
@Blckknght, , , callable .