Skip to content

Commit 62088c7

Browse files
committed
Add more comments
1 parent cdb7cca commit 62088c7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Lib/functools.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ def _get_dispatch_param(func, *, _insideclass=False):
895895
Used by singledispatch for registration by type annotation of the parameter.
896896
"""
897897
# Fast path for typical callables and descriptors.
898-
# idx is 0 when singledispatch() and 1 when singledispatchmethod()
898+
# idx is 0 when singledispatch() and 1 when singledispatchmethod().
899899
idx = _insideclass
900900
if isinstance(func, staticmethod):
901901
idx = 0
@@ -904,6 +904,7 @@ def _get_dispatch_param(func, *, _insideclass=False):
904904
func = func.__func__
905905
idx = 1
906906
if isinstance(func, FunctionType) and not hasattr(func, "__wrapped__"):
907+
# Method from inspect._signature_from_function.
907908
func_code = func.__code__
908909
try:
909910
return func_code.co_varnames[:func_code.co_argcount][idx]
@@ -1150,6 +1151,7 @@ def __wrapped__(self):
11501151

11511152
@property
11521153
def register(self):
1154+
# This is called from outside of the class with singledispatchmethod.
11531155
return partial(self._unbound.register, _insideclass=False)
11541156

11551157

0 commit comments

Comments
 (0)