Title: Funny behaviour with Union[Decimal, int] · Issue #1442 · python/mypy · GitHub
Open Graph Title: Funny behaviour with Union[Decimal, int] · Issue #1442 · python/mypy
X Title: Funny behaviour with Union[Decimal, int] · Issue #1442 · python/mypy
Description: Considering the following program: from decimal import Decimal from typing import Union def foo(bar: Union[Decimal, int]): print(Decimal(1) + bar) print(bar + Decimal(1)) Why does mypy complain in the second print()? $ mypy foo.py foo.py...
Open Graph Description: Considering the following program: from decimal import Decimal from typing import Union def foo(bar: Union[Decimal, int]): print(Decimal(1) + bar) print(bar + Decimal(1)) Why does mypy complain in ...
X Description: Considering the following program: from decimal import Decimal from typing import Union def foo(bar: Union[Decimal, int]): print(Decimal(1) + bar) print(bar + Decimal(1)) Why does mypy complain in ...
Opengraph URL: https://github.com/python/mypy/issues/1442
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Funny behaviour with Union[Decimal, int]","articleBody":"Considering the following program:\n\n```\nfrom decimal import Decimal\nfrom typing import Union\n\ndef foo(bar: Union[Decimal, int]):\n print(Decimal(1) + bar)\n print(bar + Decimal(1))\n```\n\nWhy does `mypy` complain in the second print()?\n\n```\n$ mypy foo.py\nfoo.py: note: In function \"foo\":\nfoo.py:6: error: Unsupported operand types for + (\"Union[Decimal, int]\" and \"Decimal\")\n```\n\nI'm using mypy 0.3.1 on Python 3.5.1, Ubuntu 16.04.\n","author":{"url":"https://github.com/admirabilis","@type":"Person","name":"admirabilis"},"datePublished":"2016-04-26T20:04:26Z","url":"https://github.com/python/mypy/issues/1442"}
| 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:219ec600-ba8d-71b4-12a1-8f58394e3b6a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B02C:3EE8F1:13716F4:198D166:6B000AB3 |
| html-safe-nonce | 08aecba99f4df21c0b1fffe758d431bb53a869f22d1b2760dc3c30f2b0403219 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMDJDOjNFRThGMToxMzcxNkY0OjE5OEQxNjY6NkIwMDBBQjMiLCJ2aXNpdG9yX2lkIjoiMzUwNTY0NjYzMDU2NzE1MjMwNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4ca3e5296cffd348dad77f4420ccb605247753e724f397d4cb09a98ec57b7f0b |
| hovercard-subject-tag | issue:151226410 |
| 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/1442/issue_layout |
| twitter:image | https://opengraph.githubassets.com/48ea3d685a62ca7ede2c7a8a4849ab267a32c887e8da961b843dba387d6dced9/python/mypy/issues/1442 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/48ea3d685a62ca7ede2c7a8a4849ab267a32c887e8da961b843dba387d6dced9/python/mypy/issues/1442 |
| og:image:alt | Considering the following program: from decimal import Decimal from typing import Union def foo(bar: Union[Decimal, int]): print(Decimal(1) + bar) print(bar + Decimal(1)) Why does mypy complain in ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | admirabilis |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729 |
| 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 | 16a11879678aaf97e2a42c33ee70830aa084fa37 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width