Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 548cb60

Browse files
andresdelfinocsabella
authored andcommitted
bpo-34085: Improve wording on classmethod/staticmethod (#8228)
* bpo-34085: Improve wording on classmethod/staticmethod * Address comments from Éric * Address comments from Éric
1 parent 360e1e4 commit 548cb60

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

Doc/library/functions.rst

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -211,19 +211,18 @@ are always available. They are listed here in alphabetical order.
211211
@classmethod
212212
def f(cls, arg1, arg2, ...): ...
213213

214-
The ``@classmethod`` form is a function :term:`decorator` -- see the description
215-
of function definitions in :ref:`function` for details.
214+
The ``@classmethod`` form is a function :term:`decorator` -- see
215+
:ref:`function` for details.
216216

217-
It can be called either on the class (such as ``C.f()``) or on an instance (such
217+
A class method can be called either on the class (such as ``C.f()``) or on an instance (such
218218
as ``C().f()``). The instance is ignored except for its class. If a class
219219
method is called for a derived class, the derived class object is passed as the
220220
implied first argument.
221221

222222
Class methods are different than C++ or Java static methods. If you want those,
223-
see :func:`staticmethod` in this section.
223+
see :func:`staticmethod`.
224224

225-
For more information on class methods, consult the documentation on the standard
226-
type hierarchy in :ref:`types`.
225+
For more information on class methods, see :ref:`types`.
227226

228227

229228
.. function:: compile(source, filename, mode, flags=0, dont_inherit=False, optimize=-1)
@@ -1452,11 +1451,11 @@ are always available. They are listed here in alphabetical order.
14521451
@staticmethod
14531452
def f(arg1, arg2, ...): ...
14541453

1455-
The ``@staticmethod`` form is a function :term:`decorator` -- see the
1456-
description of function definitions in :ref:`function` for details.
1454+
The ``@staticmethod`` form is a function :term:`decorator` -- see
1455+
:ref:`function` for details.
14571456

1458-
It can be called either on the class (such as ``C.f()``) or on an instance (such
1459-
as ``C().f()``). The instance is ignored except for its class.
1457+
A static method can be called either on the class (such as ``C.f()``) or on an instance (such
1458+
as ``C().f()``).
14601459

14611460
Static methods in Python are similar to those found in Java or C++. Also see
14621461
:func:`classmethod` for a variant that is useful for creating alternate class
@@ -1471,8 +1470,7 @@ are always available. They are listed here in alphabetical order.
14711470
class C:
14721471
builtin_open = staticmethod(open)
14731472

1474-
For more information on static methods, consult the documentation on the
1475-
standard type hierarchy in :ref:`types`.
1473+
For more information on static methods, see :ref:`types`.
14761474

14771475

14781476
.. index::

0 commit comments

Comments
 (0)