-
-
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
Use a more precise return type for tokenize.untokenize()
#13366
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
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.
Hi, @tomasr8! We usually avoid having union return types. See https://github.com/python/typeshed/blob/main/CONTRIBUTING.md#conventions
We might be able to use the Any trick. If we use |
This seems like the better option to me, as opposed to leaving it completely untyped |
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.
Let's try the Any
trick.
Diff from mypy_primer, showing the effect of this PR on open source code: schemathesis (https://github.com/schemathesis/schemathesis)
- File "/tmp/mypy_primer/old_mypy/venv/bin/mypy", line 8, in <module>
+ File "/tmp/mypy_primer/new_mypy/venv/bin/mypy", line 8, in <module>
- File "/tmp/mypy_primer/old_mypy/venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
+ File "/tmp/mypy_primer/new_mypy/venv/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
|
No description provided.