Title: How much do we care about positional-only args? · Issue #3693 · python/typeshed · GitHub
Open Graph Title: How much do we care about positional-only args? · Issue #3693 · python/typeshed
X Title: How much do we care about positional-only args? · Issue #3693 · python/typeshed
Description: It's fairly common for arguments that were positional-only to become no longer positional-only between minor versions of Python. For example, zipimport between 3.7 and 3.8: Details ~/dev/mypy/scripts stubtest2 λ python3.8 stubtest.py --c...
Open Graph Description: It's fairly common for arguments that were positional-only to become no longer positional-only between minor versions of Python. For example, zipimport between 3.7 and 3.8: Details ~/dev/mypy/scrip...
X Description: It's fairly common for arguments that were positional-only to become no longer positional-only between minor versions of Python. For example, zipimport between 3.7 and 3.8: Details ~/dev/mypy/s...
Opengraph URL: https://github.com/python/typeshed/issues/3693
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"How much do we care about positional-only args?","articleBody":"It's fairly common for arguments that were positional-only to become no longer positional-only between minor versions of Python. For example, zipimport between 3.7 and 3.8:\r\n\r\n\u003cdetails>\r\n\r\n```\r\n~/dev/mypy/scripts stubtest2 λ python3.8 stubtest.py --custom-typeshed-dir ~/dev/typeshed --concise zipimport\r\nzipimport.zipimporter.__init__ is inconsistent, stub argument \"archivepath\" differs from runtime argument \"path\"\r\nzipimport.zipimporter.find_loader is not present in stub\r\nzipimport.zipimporter.find_module is inconsistent, runtime argument \"path\" has a default value of type None, which is incompatible with stub argument type builtins.str\r\nzipimport.zipimporter.get_resource_reader is not present in stub\r\n\r\n~/dev/mypy/scripts stubtest2 λ python3.7 stubtest.py --custom-typeshed-dir ~/dev/typeshed --concise zipimport\r\nzipimport.zipimporter.find_loader is not present in stub\r\nzipimport.zipimporter.find_module is inconsistent, stub argument \"fullname\" should be positional-only (rename with a leading double underscore, i.e. \"__fullname\")\r\nzipimport.zipimporter.find_module is inconsistent, runtime argument \"path\" has a default value of type None, which is incompatible with stub argument type builtins.str\r\nzipimport.zipimporter.find_module is inconsistent, stub argument \"path\" should be positional-only (rename with a leading double underscore, i.e. \"__path\")\r\nzipimport.zipimporter.get_code is inconsistent, stub argument \"fullname\" should be positional-only (rename with a leading double underscore, i.e. \"__fullname\")\r\nzipimport.zipimporter.get_data is inconsistent, stub argument \"pathname\" should be positional-only (rename with a leading double underscore, i.e. \"__pathname\")\r\nzipimport.zipimporter.get_filename is inconsistent, stub argument \"fullname\" should be positional-only (rename with a leading double underscore, i.e. \"__fullname\")\r\nzipimport.zipimporter.get_resource_reader is not present in stub\r\nzipimport.zipimporter.get_source is inconsistent, stub argument \"fullname\" should be positional-only (rename with a leading double underscore, i.e. \"__fullname\")\r\nzipimport.zipimporter.is_package is inconsistent, stub argument \"fullname\" should be positional-only (rename with a leading double underscore, i.e. \"__fullname\")\r\nzipimport.zipimporter.load_module is inconsistent, stub argument \"fullname\" should be positional-only (rename with a leading double underscore, i.e. \"__fullname\")\r\n```\r\n\u003c/details>\r\n\r\nWe can branch on `sys.version_info` to capture this — and I'm happy to do that — but figured I'd check whether this is actually desired or not before doing something that's pretty nitpicky. The upside here is accuracy, the downside here is it makes the stubs less readable and it can mask more important differences between Pythons.\r\n\r\nAn alternative would be to only aim for positional-only arg accuracy in the latest Python release (with anything else being discretionary). One way this would manifest is if we introduced `stubtest` to typeshed CI, we could run against older versions of Python with `--ignore-positional-only`.\r\n\r\nWhile I'm here, some other questions:\r\n- Is there a plan for using PEP 570 syntax in typeshed (does that need a change in typed_ast)? \r\n- It seems we should mark several methods in typing.pyi as using positional-only args, e.g, `Mapping.get`?\r\n- I've currently been doing a lot of module by module PRs, where these include positional-only args changes if necessary as a commit within the PR. Does this work well for reviewing / are there things I could do to make life easier (in general, not just wrt positional-only args 🙂 )?","author":{"url":"https://github.com/hauntsaninja","@type":"Person","name":"hauntsaninja"},"datePublished":"2020-01-30T22:12:17Z","url":"https://github.com/python/typeshed/issues/3693"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:90fc8431-f232-a7cb-999c-b3a5f2929a30 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B48C:1BCD46:3FDF30:55DED5:6B002BCB |
| html-safe-nonce | 22983921089aea82aea14ac896afa60d7771ca9c704faf0ec5024cd7d91a4a56 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNDhDOjFCQ0Q0NjozRkRGMzA6NTVERUQ1OjZCMDAyQkNCIiwidmlzaXRvcl9pZCI6Ijg0MTUwMzQ5MDg3NzQzNDgyOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5e0a92bd65e75d126e751cf45abccb6999ef36593ab064e9cda54007031c31aa |
| hovercard-subject-tag | issue:557787419 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/typeshed/3693/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cfe5d90ac654ec0dd9a40ebd76263cd822c3a15eb7a2dbe43b9379e5548fac04/python/typeshed/issues/3693 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cfe5d90ac654ec0dd9a40ebd76263cd822c3a15eb7a2dbe43b9379e5548fac04/python/typeshed/issues/3693 |
| og:image:alt | It's fairly common for arguments that were positional-only to become no longer positional-only between minor versions of Python. For example, zipimport between 3.7 and 3.8: Details ~/dev/mypy/scrip... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hauntsaninja |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typeshed git https://github.com/python/typeshed.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 31696383 |
| octolytics-dimension-repository_nwo | python/typeshed |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31696383 |
| octolytics-dimension-repository_network_root_nwo | python/typeshed |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width