Skip to content

Commit 6ef0f65

Browse files
committed
gh-72088: clarify inspect.ismethod returns False for class-level access
Accessing a method through the class returns a plain function, not a bound method, so ismethod() returns False in that case. Add a note and a cross-reference to the 'instance methods' section of the data model reference to explain this.
1 parent 36e4ffc commit 6ef0f65

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Doc/library/inspect.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,11 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
425425

426426
Return ``True`` if the object is a bound method written in Python.
427427

428+
Note that accessing a method through the class (rather than an instance)
429+
returns a plain :term:`function`, not a bound method, so :func:`ismethod`
430+
will return ``False`` in that case. See :ref:`instance-methods` in the
431+
language reference for details.
432+
428433

429434
.. function:: ispackage(object)
430435

0 commit comments

Comments
 (0)