I need to detect whether a function is an empty definition or not. It can be like:

def foo():
    pass

or like:

def foo(i, *arg, **kwargs):
    pass

or like:

foo = lambda x: None

What is the most elegant way to detect them using the 'inspect' module? Is there a better way than this:

def isEmptyFunction(func):
    e = lambda: None
    return func.__code__.co_code == e.__code__.co_code
Edit
Report