-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Policy regarding python version specific stub changes #874
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
Comments
According to @gvanrossum, mypy should support That said, #721, among other things, will allow most-version-specific stubs, though I agree that's not a good design. |
Currently the simplest approach is probably to just have all stubs track Python 3.5 and mark any features not present in older versions using comments. However, having |
I would like to see mypy have an "reverse stubgen" where it actually imports the module to see if all the functions really are there. |
This is obsolete as mypy now supports sys.version_info checks, and typeshed uses them widely. |
With Python 3.5 collections.OrderedDict supports
reversed()
for views of its keys, items and values. In order for mypy to support this, the stub for collections needs to be updated. As a direct result though, mypy wouldn't detect illegal code for python < 3.5:This is a specific instance of a general problem: how do we deal with different typing behaviour from version to version of python? Should the stubs only keep up with the most current version of python? It would actually be better to always use the most version-specific version of a stub (i.e.
stubs/3.3/collections.pyi
if using py3.3), or to have the ability to tell mypy to type check against a specific minor version of python.The text was updated successfully, but these errors were encountered: