Skip to content

Commit ea2fda1

Browse files
gh-143535: Move singledispatchmethod note outside example block
1 parent 666a2a8 commit ea2fda1

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Doc/library/functools.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -679,11 +679,7 @@ The :mod:`functools` module defines the following functions:
679679
decorator. When defining a method using ``@singledispatchmethod``, note
680680
that the dispatch happens on the type of the first non-*self* or non-*cls*
681681
argument::
682-
.. note::
683-
``singledispatchmethod`` dispatches the first argument during call
684-
time irrespective of whether the method is bound or unbound, as a result,
685-
``x.f(a) != C.f(x, a)``.The behavior is intentional and required to support correct dispatch for
686-
``staticmethod`` and ``classmethod``.
682+
687683
class Negator:
688684
@singledispatchmethod
689685
def neg(self, arg):
@@ -696,6 +692,11 @@ The :mod:`functools` module defines the following functions:
696692
@neg.register
697693
def _(self, arg: bool):
698694
return not arg
695+
.. note::
696+
``singledispatchmethod`` dispatches the first argument during call
697+
time irrespective of whether the method is bound or unbound, as a result,
698+
``x.f(a) != C.f(x, a)``.The behavior is intentional and required to support correct dispatch for
699+
``staticmethod`` and ``classmethod``.
699700

700701
``@singledispatchmethod`` supports nesting with other decorators such as
701702
:deco:`classmethod`. Note that to allow for

0 commit comments

Comments
 (0)