Title: Several errors in overloaded functions in the stdlib · Issue #9608 · python/typeshed · GitHub
Open Graph Title: Several errors in overloaded functions in the stdlib · Issue #9608 · python/typeshed
X Title: Several errors in overloaded functions in the stdlib · Issue #9608 · python/typeshed
Description: Attempting to add defaults to overloaded functions in #9606 highlighted many instances where we have incorrect overloads in the stdlib. An example is this overload in _bisect.pyi: typeshed/stdlib/_bisect.pyi Lines 13 to 21 in 808a431 @ov...
Open Graph Description: Attempting to add defaults to overloaded functions in #9606 highlighted many instances where we have incorrect overloads in the stdlib. An example is this overload in _bisect.pyi: typeshed/stdlib/_...
X Description: Attempting to add defaults to overloaded functions in #9606 highlighted many instances where we have incorrect overloads in the stdlib. An example is this overload in _bisect.pyi: typeshed/stdlib/_...
Opengraph URL: https://github.com/python/typeshed/issues/9608
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Several errors in overloaded functions in the stdlib","articleBody":"Attempting to add defaults to overloaded functions in #9606 highlighted many instances where we have incorrect overloads in the stdlib. An example is this overload in `_bisect.pyi`:\r\n\r\nhttps://github.com/python/typeshed/blob/808a431a57e7efb2ec8afa97840c368e760d2e11/stdlib/_bisect.pyi#L13-L21\r\n\r\nThis overload incorrectly marks the `key` parameter as having a default value. But this has several issues:\r\n- If no value is provided for this parameter by the user, we actually want the type checker to pick the _first_ overload (not this overload, which is the second overload). Specifying a default value for this parameter in this overload is confusing.\r\n- If the type checker _did_ select this overload, the `_T` TypeVar would go unsolved if no value was specified for the `key` parameter.\r\n- If we try to add the default value for this parameter (`None`), mypy will (correctly) complain that we're using an implicit optional type for the type annotation.\r\n\r\nThere are several issues like this in our stdlib stubs that should be fixed (see https://github.com/python/typeshed/pull/9606/commits/b39305ee691e2789e5e6ba4e525b2e619f0d33b4 for a summary of the problematic functions — this is the commit in #9606 in which I reverted all the defaults `stubdefaulter` had added that caused mypy to emit errors).","author":{"url":"https://github.com/AlexWaygood","@type":"Person","name":"AlexWaygood"},"datePublished":"2023-01-29T11:59:56Z","url":"https://github.com/python/typeshed/issues/9608"}
| 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:90856181-054e-32ff-4eb6-c498fcfecba0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DBD8:1AF0B6:4C0590:62541D:6AFFC01A |
| html-safe-nonce | 155f2b9be1431fb057b6f227aa02f14803332972b55945e3c6279d1224230c83 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQkQ4OjFBRjBCNjo0QzA1OTA6NjI1NDFEOjZBRkZDMDFBIiwidmlzaXRvcl9pZCI6IjYyOTcxNzkyMjYxMDU2OTIxODYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 84f7b82d92faf4c9ccb31ce848ac42c18509bdb6676bd80c7e9df749afb071b2 |
| hovercard-subject-tag | issue:1561255106 |
| 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/9608/issue_layout |
| twitter:image | https://opengraph.githubassets.com/884b823c9ece2cbe21eb2b11c980a49c07570ad926a3ee1f7b94cc323a62f192/python/typeshed/issues/9608 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/884b823c9ece2cbe21eb2b11c980a49c07570ad926a3ee1f7b94cc323a62f192/python/typeshed/issues/9608 |
| og:image:alt | Attempting to add defaults to overloaded functions in #9606 highlighted many instances where we have incorrect overloads in the stdlib. An example is this overload in _bisect.pyi: typeshed/stdlib/_... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | AlexWaygood |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1e805b832df235bb21305db712c3b6432920019dfc12cb25b9cb8d3b0c9403cf |
| 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 | 8fa4a54e6871c7908eda1c246ad5972982c0b59d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width