async def func() -> bool:
return False
async def foo() -> None:
async with trio.open_nursery() as n:
n.start_soon(func)
Running mypy on the code above gives me this error:
error: Argument 1 to "start_soon" of "Nursery" has incompatible type "Callable[[], Coroutine[Any, Any, bool]]"; expected "Union[Callable[[], Awaitable[None]], Callable[[Any], Awaitable[None]], Callable[[Any, Any], Awaitable[None]], Callable[[Any, Any, Any], Awaitable[None]], Callable[[Any, Any, Any, Any], Awaitable[None]], Callable[[VarArg(Any)], Awaitable[None]]]"
If I change func()'s signature to return None/Any, it doesn't complain, but I don't see why start_soon() should require that?
I understand the return value of the func is discarded by start_soon(), but in my real code I sometimes run that same func with trio.gather(), in which case I want the return value
Running mypy on the code above gives me this error:
If I change func()'s signature to return None/Any, it doesn't complain, but I don't see why start_soon() should require that?
I understand the return value of the func is discarded by start_soon(), but in my real code I sometimes run that same func with trio.gather(), in which case I want the return value