Title: `sum` stub too permissive · Issue #7574 · python/typeshed · GitHub
Open Graph Title: `sum` stub too permissive · Issue #7574 · python/typeshed
X Title: `sum` stub too permissive · Issue #7574 · python/typeshed
Description: Currently the stub for the sum built-in allows any iterable as an argument typeshed/stdlib/builtins.pyi Lines 1480 to 1489 in ae6ff79 @overload def sum(__iterable: Iterable[_T]) -> _T | Literal[0]: ... if sys.version_info >= (3, 8): @ove...
Open Graph Description: Currently the stub for the sum built-in allows any iterable as an argument typeshed/stdlib/builtins.pyi Lines 1480 to 1489 in ae6ff79 @overload def sum(__iterable: Iterable[_T]) -> _T | Literal[0]:...
X Description: Currently the stub for the sum built-in allows any iterable as an argument typeshed/stdlib/builtins.pyi Lines 1480 to 1489 in ae6ff79 @overload def sum(__iterable: Iterable[_T]) -> _T | Literal[...
Opengraph URL: https://github.com/python/typeshed/issues/7574
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`sum` stub too permissive","articleBody":"Currently the stub for the `sum` built-in allows any iterable as an argument\r\nhttps://github.com/python/typeshed/blob/ae6ff79c0e14cd054bf07374e7091a098a46cf1f/stdlib/builtins.pyi#L1480-L1489\r\n\r\nThis means mypy has no issue with:\r\n```python\r\nsum(\"hello\")\r\n```\r\nWhich results in this error at runtime:\r\n```\r\nTypeError: unsupported operand type(s) for +: 'int' and 'str'\r\n```\r\n\r\ncontext: I was introducing someone to mypy and used the example above as something that mypy should flag, but turns out it wasn't being flagged so logging here.","author":{"url":"https://github.com/jpy-git","@type":"Person","name":"jpy-git"},"datePublished":"2022-04-01T09:13:34Z","url":"https://github.com/python/typeshed/issues/7574"}
| 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:d9086439-27fa-396a-cdbd-af12259e4f4e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 838E:2A0045:353A16C:4698E65:6B0042FC |
| html-safe-nonce | 810c0d82da7cde2a7e9633a99d9b4794cf5540971bde4926cc807b0c4bad3d0c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MzhFOjJBMDA0NTozNTNBMTZDOjQ2OThFNjU6NkIwMDQyRkMiLCJ2aXNpdG9yX2lkIjoiNzk2NzcyNjgxNzY3NzE2NTMwOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c15c304a41aac15f5b25cc98d6184dbd8498e42e1501bb1293ebe1b3c38a1908 |
| hovercard-subject-tag | issue:1189498035 |
| 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/7574/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7cb5de3f61cb0eb076a5929128d17f5b02c8970cc1a6c56ef8b281c3786990ce/python/typeshed/issues/7574 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7cb5de3f61cb0eb076a5929128d17f5b02c8970cc1a6c56ef8b281c3786990ce/python/typeshed/issues/7574 |
| og:image:alt | Currently the stub for the sum built-in allows any iterable as an argument typeshed/stdlib/builtins.pyi Lines 1480 to 1489 in ae6ff79 @overload def sum(__iterable: Iterable[_T]) -> _T | Literal[0]:... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jpy-git |
| 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