Передача partial в Callable аргумент выдает предупреждение
Почему PyCharm выдаёт предупреждение о несоответствии типов на такой код?
import collections.abc
import functools
def bar(op: collections.abc.Callable[[int, int], int], x: int, y: int) -> int:
return op(x, y)
def foo(callable_object: collections.abc.Callable[[int, int], int]) -> int:
return callable_object(2, 2)
print(foo(functools.partial(bar, lambda x, y: x + y)))
Почему Mypy не выдаёт предупреждения на такой код (лишний параметр у лямбды)?
import collections.abc
import functools
def bar(op: collections.abc.Callable[[int, int], int], x: int, y: int) -> int:
return op(x, y)
def foo(callable_object: collections.abc.Callable[[int, int], int]) -> int:
return callable_object(2, 2)
print(foo(functools.partial(bar, lambda x, y, z: x + y)))