Title: Question about usage of union of Tuples · Issue #391 · python/typing · GitHub
Open Graph Title: Question about usage of union of Tuples · Issue #391 · python/typing
X Title: Question about usage of union of Tuples · Issue #391 · python/typing
Description: I just started trying to apply typing to a code base, so I may be greatly miss-understanding what I am doing, but here we go :) We have a case where we get a tuple back from a user supplied function which must be (None, None), (some_not_...
Open Graph Description: I just started trying to apply typing to a code base, so I may be greatly miss-understanding what I am doing, but here we go :) We have a case where we get a tuple back from a user supplied functio...
X Description: I just started trying to apply typing to a code base, so I may be greatly miss-understanding what I am doing, but here we go :) We have a case where we get a tuple back from a user supplied functio...
Opengraph URL: https://github.com/python/typing/issues/391
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Question about usage of union of Tuples","articleBody":"I just started trying to apply typing to a code base, so I may be greatly miss-understanding what I am doing, but here we go :)\r\n\r\nWe have a case where we get a tuple back from a user supplied function which must be `(None, None)`, `(some_not_none, None)`, or `(some_not_none, other_not_none)`, that the second value can only be not `None` if the first value is also not `None`. (This is why I did not do `Tuple[Optional[int], Optional[int]]`).\r\n\r\nA minimal example to reproduce the issues is\r\n\r\n```python\r\nfrom typing import Tuple, Union\r\n\r\nInputType = Union[Tuple[None, None],\r\n Tuple[int, None],\r\n Tuple[int, int]]\r\n\r\n\r\ndef f(a: InputType) -> None:\r\n b, c = a\r\n\r\n\r\n```\r\n\r\nwhich gives\r\n\r\n```\r\n(dd36) ✔ ~ \r\n17:32 $ mypy --version\r\nmypy 0.471\r\n(dd36) ✔ ~ \r\n17:32 $ mypy /tmp/test.py\r\n/tmp/test.py:9: error: 'Union[Tuple[void, void], Tuple[builtins.int, void], Tuple[builtins.int, builtins.int]]' object is not iterable\r\n\r\n```\r\n\r\n","author":{"url":"https://github.com/tacaswell","@type":"Person","name":"tacaswell"},"datePublished":"2017-02-13T22:49:56Z","url":"https://github.com/python/typing/issues/391"}
| 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:7cfa72bc-dcc8-689e-0d51-b8e434e70a06 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E5DC:22E079:14932F9:1AED0CC:6B000A10 |
| html-safe-nonce | da5f91e6ebebfe1d12c9acd0b75f9bf96ba064f50e2a924125cc02ffd02f00ae |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNURDOjIyRTA3OToxNDkzMkY5OjFBRUQwQ0M6NkIwMDBBMTAiLCJ2aXNpdG9yX2lkIjoiNjU3NjI5MzgxMzM0NDUzNzEwNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f68768a3aded014eb64a071e8b899e4cad2f93b7c558e689d7ed86972d58c78d |
| hovercard-subject-tag | issue:207363437 |
| 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/typing/391/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fab0a34ad4febcd49bbf396c3be08691a42bac33aec53061d835bb0d699806bd/python/typing/issues/391 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fab0a34ad4febcd49bbf396c3be08691a42bac33aec53061d835bb0d699806bd/python/typing/issues/391 |
| og:image:alt | I just started trying to apply typing to a code base, so I may be greatly miss-understanding what I am doing, but here we go :) We have a case where we get a tuple back from a user supplied functio... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tacaswell |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typing git https://github.com/python/typing.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 24604008 |
| octolytics-dimension-repository_nwo | python/typing |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24604008 |
| octolytics-dimension-repository_network_root_nwo | python/typing |
| 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 | 16a11879678aaf97e2a42c33ee70830aa084fa37 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width