Skip to content

Commit 91b96f5

Browse files
committed
gh-72088: include @staticmethod behavior in inspect notes
1 parent cb78792 commit 91b96f5

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

Doc/library/inspect.rst

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,8 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
432432
will return ``False`` in that case. See :ref:`instance-methods` in the
433433
language reference for details.
434434

435+
For static methods (:deco:`staticmethod`), this will always return ``False``.
436+
435437

436438
.. function:: ispackage(object)
437439

@@ -452,6 +454,8 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
452454
will return ``True`` in that case. See :ref:`instance-methods` in the
453455
language reference for details.
454456

457+
For static methods (:deco:`staticmethod`), this will always return ``True``.
458+
455459

456460
.. function:: isgeneratorfunction(object)
457461

@@ -469,8 +473,11 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
469473

470474
Accessing an instance method through the class (rather than an instance)
471475
returns a plain :term:`function`, not a bound method, so :func:`isgeneratorfunction`
472-
will return ``True`` in that case. See :ref:`instance-methods` in the
473-
language reference for details.
476+
will return ``True`` if it is a generator function. See :ref:`instance-methods`
477+
in the language reference for details.
478+
479+
For a static method (:deco:`staticmethod`), this will return ``True`` if it
480+
is a generator function.
474481

475482
.. function:: isgenerator(object)
476483

@@ -502,8 +509,11 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
502509

503510
Accessing an instance method through the class (rather than an instance)
504511
returns a plain :term:`function`, not a bound method, so :func:`iscoroutinefunction`
505-
will return ``True`` in that case. See :ref:`instance-methods` in the
506-
language reference for details.
512+
will return ``True`` if it is a coroutine function. See :ref:`instance-methods`
513+
in the language reference for details.
514+
515+
For a static method (:deco:`staticmethod`), this will return ``True`` if it
516+
is a coroutine function.
507517

508518

509519
.. function:: markcoroutinefunction(func)

0 commit comments

Comments
 (0)