[issue47214] builtin_function_or_method is also either a function or a method

2022-04-04 Thread Ravi Jain
Ravi Jain added the comment: yes, I think `inspect.isroutine` does the required functionality. sorry, I did not know about it, and could not think of the word `routine` when checking for functions. -- ___ Python tracker

[issue47214] builtin_function_or_method is also either a function or a method

2022-04-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: Perhaps what you want is inspect.isroutine ? https://docs.python.org/3/library/inspect.html#inspect.isroutine I agree with Dennis that the isfunction test is for **Python** (def or lambda) functions, not builtins. The docstring for the inspect.is* methods m

[issue47214] builtin_function_or_method is also either a function or a method

2022-04-04 Thread Ravi Jain
Ravi Jain added the comment: but `callable` returns `True` for classes with `__call__` also, it does not check whether the argument passed to it is a function or not. I want some way to return `True` for both builtin functions and Python functions, but not for classes. And similarly, some w

[issue47214] builtin_function_or_method is also either a function or a method

2022-04-04 Thread Dennis Sweeney
Dennis Sweeney added the comment: https://docs.python.org/3/library/inspect.html#inspect.isfunction says this: """ inspect.isfunction(object) Return True if the object is a Python function, which includes functions created by a lambda expression. """ Emphasis on the "Python function", as in,

[issue47214] builtin_function_or_method is also either a function or a method

2022-04-04 Thread Ravi Jain
New submission from Ravi Jain : the. ``` import inspect inspect.isfunction ``` does not consider a ``` builtin_function_or_method ``` as a function. for example, ``` inspect.isfunction(abs) ``` gives, ``` False ``` in the background even the builtin `abs` is a function, so shouldn't it return T