Open
Description
def foo(callback):
callback()
There's a few ways to type this function:
def foo(callback: Callable[[], None]) -> None: ...
def foo(callback: Callable[[], Any]) -> None: ...
def foo(callback: Callable[[], object]) -> None: ...
Callable[[], None]
is not great, because it doesn't allow you to pass a callback that does return something; that will also work at runtime, and the return value is ignored. When I learned about this, I changed my callbacks to use Callable[[], Any]
instead. But Callable[[], object]
would be even better.
We could check for this, but does it belong to this tool? This lint isn't really stub-specific.