-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stricter typing for TaskGroup.start()
#678
Labels
enhancement
New feature or request
Comments
I just see previous attempts have been made to supply types for See: #511 When trying to finalize a PR, I was hitting exactly those issues, so I guess we have to wait for mypy... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looking at how we type
TaskGroup.start_soon
, we can do the same approach to have stricter type checking onTaskGroup.start
.We can do the following:
Example usage::
On the last line, typing the result as
float
is still important, otherwise it will beAny
. Mypy's type inference is lacking here. But if we would type it asstr
, then mypy would say:That is significantly better than
object
what we currently have here:https://github.com/agronholm/anyio/blob/master/src/anyio/abc/_tasks.py#L70
What do you think?
The text was updated successfully, but these errors were encountered: