mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
bpo-43427: Separte the method overview from the static method specifics. (GH-24787)
This commit is contained in:
parent
f917efccf8
commit
f00e82f8b8
1 changed files with 6 additions and 2 deletions
|
@ -1139,8 +1139,8 @@ If you have ever wondered where *self* comes from in regular methods or where
|
||||||
*cls* comes from in class methods, this is it!
|
*cls* comes from in class methods, this is it!
|
||||||
|
|
||||||
|
|
||||||
Static methods
|
Other kinds of methods
|
||||||
--------------
|
----------------------
|
||||||
|
|
||||||
Non-data descriptors provide a simple mechanism for variations on the usual
|
Non-data descriptors provide a simple mechanism for variations on the usual
|
||||||
patterns of binding functions into methods.
|
patterns of binding functions into methods.
|
||||||
|
@ -1163,6 +1163,10 @@ This chart summarizes the binding and its two most useful variants:
|
||||||
| classmethod | f(type(obj), \*args) | f(cls, \*args) |
|
| classmethod | f(type(obj), \*args) | f(cls, \*args) |
|
||||||
+-----------------+----------------------+------------------+
|
+-----------------+----------------------+------------------+
|
||||||
|
|
||||||
|
|
||||||
|
Static methods
|
||||||
|
--------------
|
||||||
|
|
||||||
Static methods return the underlying function without changes. Calling either
|
Static methods return the underlying function without changes. Calling either
|
||||||
``c.f`` or ``C.f`` is the equivalent of a direct lookup into
|
``c.f`` or ``C.f`` is the equivalent of a direct lookup into
|
||||||
``object.__getattribute__(c, "f")`` or ``object.__getattribute__(C, "f")``. As a
|
``object.__getattribute__(c, "f")`` or ``object.__getattribute__(C, "f")``. As a
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue