-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Reverted] Improved annotations for select.select() #1080
Conversation
The TypeVars allow mypy to enforce that the returned lists are subsets of the arguments.
stdlib/3/select.pyi
Outdated
_X = TypeVar("_X") | ||
def select(rlist: Sequence[_R], wlist: Sequence[_W], xlist: Sequence[_X], | ||
timeout: float = ...) -> Tuple[List[_R], | ||
List[_W], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix up the indentation here.
Thanks! |
Ow, this caused mypy's runtests.py to fail as follows:
See discussion in #1059. |
So the specific example was something like rlist, wlist, xlist = select(rlist, wlist, []) so mypy now complains that it doesn't have an item type for I'm not sure how to resolve this -- reverting this PR feels sad, but that might be a common case (since few people even know what to do with |
OTOH a simple solution would be to add casts to the sample code, e.g. |
This make mypy's runtests.py pass again with HEAD typeshed. See python/typeshed#1080 (comment)
Hm, it seems like most code that uses |
But we could at least preserve the arguments as |
BTW This is pretty common fallout from a sudden surge in contributions and nothing we should get too upset about. We just need to diligently fix the new issues. |
Yeah, I'm going to revert this. Please try again with just the argument types. |
Thanks. will follow up in a few days. |
The TypeVars allow mypy to enforce that the returned lists are subsets of the arguments.