-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Callable[[], Any] vs Callable[[], object] #6117
Comments
|
There are quite a few
|
For extra clarity, we could define |
I don't really like the Knowing that I also don't like the idea of adding very frequently needed things to I also don't think this needs more clarity, as |
I've come to see |
Other than for semantics, where |
We've switched to use |
FWIW I experimented with adding a check to flake8-pyi, but couldn't see a way of doing it without a level of false positives that to me would be unacceptable :/ I don't want to close PyCQA/flake8-pyi#237 yet though, as maybe we can figure out a way of doing non-blocking flake8-pyi checks that we can integrate well into our typeshed CI. |
Often the return value of a callback function is ignored. In those cases, I have previously used
Callable[[], None]
, but then @srittau told me to useCallable[[], Any]
, and I changed all stubs I had written to typeshed.It seems like
Callable[[], object]
does the same thing asCallable[[], Any]
though, and when used in a.py
file, also prevents accidentally doing something with the return value. Would it be preferable in typeshed?The text was updated successfully, but these errors were encountered: