Program - function to check whether a given name is function or method


Topic: Program - function to check whether a given name is function or method

Solution

def inspect_func(fn):
    from inspect import isfunction, ismethod
    print(f'{fn} is method {ismethod(func)}')
    print(f'{fn} is function {isfunction(func)}')



List all Python Programs