mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.14] gh-140873: Fix the singledispatchmethod documentation (GH-141523)
It does not support non-descriptor callables yet.
This commit is contained in:
parent
3388413fc5
commit
d89eb2f984
2 changed files with 2 additions and 3 deletions
|
|
@ -672,7 +672,7 @@ The :mod:`functools` module defines the following functions:
|
||||||
dispatch>` :term:`generic function`.
|
dispatch>` :term:`generic function`.
|
||||||
|
|
||||||
To define a generic method, decorate it with the ``@singledispatchmethod``
|
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*
|
that the dispatch happens on the type of the first non-*self* or non-*cls*
|
||||||
argument::
|
argument::
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -995,8 +995,7 @@ def wrapper(*args, **kw):
|
||||||
class singledispatchmethod:
|
class singledispatchmethod:
|
||||||
"""Single-dispatch generic method descriptor.
|
"""Single-dispatch generic method descriptor.
|
||||||
|
|
||||||
Supports wrapping existing descriptors and handles non-descriptor
|
Supports wrapping existing descriptors.
|
||||||
callables as instance methods.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, func):
|
def __init__(self, func):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue