Title: Update documentation to reflect that bool is a subtype of int · Issue #8069 · python/mypy · GitHub
Open Graph Title: Update documentation to reflect that bool is a subtype of int · Issue #8069 · python/mypy
X Title: Update documentation to reflect that bool is a subtype of int · Issue #8069 · python/mypy
Description: Bool is a subtype of int. The goals of this issue is to document this in a good way in the mypy documentation. A short example: This can cause problems when a function is expected to return an int, but in reality returns a bool. Take thi...
Open Graph Description: Bool is a subtype of int. The goals of this issue is to document this in a good way in the mypy documentation. A short example: This can cause problems when a function is expected to return an int,...
X Description: Bool is a subtype of int. The goals of this issue is to document this in a good way in the mypy documentation. A short example: This can cause problems when a function is expected to return an int,...
Opengraph URL: https://github.com/python/mypy/issues/8069
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Update documentation to reflect that bool is a subtype of int","articleBody":"Bool is a subtype of int. \r\n\r\nThe goals of this issue is to document this in a good way in the mypy documentation.\r\n\r\nA short example:\r\n\r\nThis can cause problems when a function is expected to return an int, but in reality returns a bool.\r\nTake this code for example:\r\n\r\n```python\r\ndef example(x: int) -> int:\r\n if x := x > 0:\r\n return x\r\n return 0\r\n```\r\nThe expectation is that this function will return only positive integers or 0. \r\nWhat happens is that it will return `bool` for positive integers and `0` for non positive ints.\r\n\r\nThis is a weird edge case for python3. See also this blog:\r\nhttps://medium.com/@timb07/python-bool-wat-ab0e28d879c7\r\n\r\nAs per: https://github.com/python/mypy/issues/8053","author":{"url":"https://github.com/rvanlaar","@type":"Person","name":"rvanlaar"},"datePublished":"2019-12-04T09:42:44Z","url":"https://github.com/python/mypy/issues/8069"}
| 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:a1f2061d-dfa6-6d84-def2-9ae81d92256d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9B94:2FF516:A6EE36:DFD850:6B0046C3 |
| html-safe-nonce | cf536a907354fed452fc3cb6ddb7ec389dbd48b39cbf877e624987c45a16685d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Qjk0OjJGRjUxNjpBNkVFMzY6REZEODUwOjZCMDA0NkMzIiwidmlzaXRvcl9pZCI6IjM2MjE4ODkyODQ3NzgyNDc4NzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 324adaf12136f5164e00c3e215d802f22e7d124ed9cabc41755f312717c371f8 |
| hovercard-subject-tag | issue:532562979 |
| 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/mypy/8069/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7417111b07f288d52fc75e4e11dd8d7a82929ec5c1ea050a4094183fbd27eb13/python/mypy/issues/8069 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7417111b07f288d52fc75e4e11dd8d7a82929ec5c1ea050a4094183fbd27eb13/python/mypy/issues/8069 |
| og:image:alt | Bool is a subtype of int. The goals of this issue is to document this in a good way in the mypy documentation. A short example: This can cause problems when a function is expected to return an int,... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rvanlaar |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| 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