-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
Replace typing overloads with a functools.wraps declaration. #225
Conversation
@bswck in #224 (comment) noted that this technique does in fact appear to do the right thing when types are validated with pylance, but not so much with mypy. That's actually pretty encouraging and suggests that may be the best approach for a library like this - to signal the intent and let the typing systems catch up. Especially if mypy is tracking this issue and has plans to implement it, I'd say that's good enough.... |
python/mypy#10574 appears to be related. python/mypy#12573 suggests that mypy may be philosophically opposed to dynamic behavior. |
I ended up with the silliest open = open being a working solution in both mypy and pylance. |
I suspect (and confirmed) that's also the case for |
Yeah, it can be retained by |
It would be more useful for |
I wonder, though, if in this case, |
I've not used pylance. I have VSCode and I see Pylance warnings, but I'm unsure how to elicit the output of |
Definitely this or |
Actually, nevermind. |
I should have been more cautious about merging this. It breaks on Python 3.11 (only, not 3.10 or 3.12) during test collection:
The issue was reported in python/cpython#117692. |
No description provided.