mirror of
https://github.com/python/cpython.git
synced 2026-05-06 12:49:07 -04:00
[3.13] gh-140873: Fix the singledispatchmethod documentation (GH-141523) (GH-141710)
It does not support non-descriptor callables yet.
(cherry picked from commit d89eb2f984)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
committed by
GitHub
parent
b41963a4aa
commit
8f7188847f
@@ -620,7 +620,7 @@ The :mod:`functools` module defines the following functions:
|
||||
dispatch>` :term:`generic function`.
|
||||
|
||||
To define a generic method, decorate it with the ``@singledispatchmethod``
|
||||
decorator. When defining a function using ``@singledispatchmethod``, note
|
||||
decorator. When defining a method using ``@singledispatchmethod``, note
|
||||
that the dispatch happens on the type of the first non-*self* or non-*cls*
|
||||
argument::
|
||||
|
||||
|
||||
+1
-2
@@ -947,8 +947,7 @@ def singledispatch(func):
|
||||
class singledispatchmethod:
|
||||
"""Single-dispatch generic method descriptor.
|
||||
|
||||
Supports wrapping existing descriptors and handles non-descriptor
|
||||
callables as instance methods.
|
||||
Supports wrapping existing descriptors.
|
||||
"""
|
||||
|
||||
def __init__(self, func):
|
||||
|
||||
Reference in New Issue
Block a user