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

Skip to content
Prev Previous commit
Next Next commit
gh-143535: Move singledispatchmethod note outside example block
  • Loading branch information
priyanshu2282-cyber committed Jan 9, 2026
commit ea2fda1cdbde5d32d0c3f57f3b4a8c099853ee87
11 changes: 6 additions & 5 deletions Doc/library/functools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -679,11 +679,7 @@
decorator. When defining a method using ``@singledispatchmethod``, note
that the dispatch happens on the type of the first non-*self* or non-*cls*
argument::
.. note::
``singledispatchmethod`` dispatches the first argument during call
time irrespective of whether the method is bound or unbound, as a result,
``x.f(a) != C.f(x, a)``.The behavior is intentional and required to support correct dispatch for
``staticmethod`` and ``classmethod``.

class Negator:
@singledispatchmethod
def neg(self, arg):
Expand All @@ -696,6 +692,11 @@
@neg.register
def _(self, arg: bool):
return not arg
.. note::

Check warning on line 695 in Doc/library/functools.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

Literal block ends without a blank line; unexpected unindent. [docutils]
Comment thread
johnslavik marked this conversation as resolved.
Outdated
``singledispatchmethod`` dispatches the first argument during call
time irrespective of whether the method is bound or unbound, as a result,
``x.f(a) != C.f(x, a)``.The behavior is intentional and required to support correct dispatch for

Check warning on line 698 in Doc/library/functools.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

Block quote ends without a blank line; unexpected unindent. [docutils]
``staticmethod`` and ``classmethod``.

``@singledispatchmethod`` supports nesting with other decorators such as
:deco:`classmethod`. Note that to allow for
Expand Down
Loading