mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
[3.12] gh-117903: Clarify that the staticmethod descriptor is callable (GH-117925) (GH-118509)
(cherry picked from commit b3372481b6
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
c48e0ef7dd
commit
f61de0de64
1 changed files with 3 additions and 2 deletions
|
@ -1723,8 +1723,9 @@ are always available. They are listed here in alphabetical order.
|
|||
:ref:`function` for details.
|
||||
|
||||
A static method can be called either on the class (such as ``C.f()``) or on
|
||||
an instance (such as ``C().f()``). Moreover, they can be called as regular
|
||||
functions (such as ``f()``).
|
||||
an instance (such as ``C().f()``).
|
||||
Moreover, the static method :term:`descriptor` is also callable, so it can
|
||||
be used in the class definition (such as ``f()``).
|
||||
|
||||
Static methods in Python are similar to those found in Java or C++. Also, see
|
||||
:func:`classmethod` for a variant that is useful for creating alternate class
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue