mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Make functools.cmp_to_key more realistic (#458)
The documentation[1] says:
A comparison function is any callable that accept two arguments,
compares them, and returns a negative number for less-than, zero for
equality, or a positive number for greater-than.
This doesn't seem possible with the comparison function defined as
returning bool.
[1] https://docs.python.org/3.6/library/functools.html#functools.cmp_to_key
This commit is contained in:
committed by
Guido van Rossum
parent
ebdf9d68b2
commit
0edb87fc6b
@@ -24,7 +24,7 @@ def update_wrapper(wrapper: _AnyCallable, wrapped: _AnyCallable, assigned: Seque
|
||||
updated: Sequence[str] = ...) -> None: ...
|
||||
def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> Callable[[_AnyCallable], _AnyCallable]: ...
|
||||
def total_ordering(cls: type) -> type: ...
|
||||
def cmp_to_key(mycmp: Callable[[_T, _T], bool]) -> Callable[[_T], Any]: ...
|
||||
def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], Any]: ...
|
||||
|
||||
class partial(Generic[_T]):
|
||||
func = ... # Callable[..., _T]
|
||||
|
||||
@@ -40,7 +40,7 @@ def update_wrapper(wrapper: _AnyCallable, wrapped: _AnyCallable, assigned: Seque
|
||||
updated: Sequence[str] = ...) -> None: ...
|
||||
def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequence[str] = ...) -> Callable[[_AnyCallable], _AnyCallable]: ...
|
||||
def total_ordering(cls: type) -> type: ...
|
||||
def cmp_to_key(mycmp: Callable[[_T, _T], bool]) -> Callable[[_T], Any]: ...
|
||||
def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], Any]: ...
|
||||
|
||||
class partial(Generic[_T]):
|
||||
func = ... # Callable[..., _T]
|
||||
|
||||
Reference in New Issue
Block a user