This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Dennis Sweeney
Recipients Dennis Sweeney, apostofes
Date 2022-04-04.14:44:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Content says this:

Return True if the object is a Python function, which includes functions created by a lambda expression.

Emphasis on the "Python function", as in, something written in Python using a `def` statement or a `lambda` expression. If isfunction returns True, you can presumably access function-specific implementation details like the functions's f.__code__ attribute. If you need to check for "anything that works as a function", you can use `callable()`:

>>> callable(lambda: 2)
>>> callable(abs)
>>> def f(x): return x
>>> callable(f)

I'm not an expert on the inspect module, but I'm guessing it's not worth breaking backwards-compatibility to change this behavior.

Would extra emphasis in the documentation have been helpful for you, or were you mostly attempting to rely on the function's name?
Date User Action Args
2022-04-04 14:44:24Dennis Sweeneysetrecipients: + Dennis Sweeney, apostofes
2022-04-04 14:44:24Dennis Sweeneysetmessageid: <>
2022-04-04 14:44:24Dennis Sweeneylinkissue47214 messages
2022-04-04 14:44:23Dennis Sweeneycreate