Title: Unsupported operand types for > ("int" and "Number") · Issue #8566 · python/mypy · GitHub
Open Graph Title: Unsupported operand types for > ("int" and "Number") · Issue #8566 · python/mypy
X Title: Unsupported operand types for > ("int" and "Number") · Issue #8566 · python/mypy
Description: Are you reporting a bug, or opening a feature request? Bug Please insert below the code you are checking with mypy. Sample 1 (mypy_error.py): from numbers import Number def is_very_large(x: Number): return x > 9000 Sample 2 (mypy_error2....
Open Graph Description: Are you reporting a bug, or opening a feature request? Bug Please insert below the code you are checking with mypy. Sample 1 (mypy_error.py): from numbers import Number def is_very_large(x: Number)...
X Description: Are you reporting a bug, or opening a feature request? Bug Please insert below the code you are checking with mypy. Sample 1 (mypy_error.py): from numbers import Number def is_very_large(x: Number)...
Opengraph URL: https://github.com/python/mypy/issues/8566
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unsupported operand types for > (\"int\" and \"Number\")","articleBody":"* Are you reporting a bug, or opening a feature request? **Bug**\r\n* Please insert below the code you are checking with mypy.\r\n\r\nSample 1 (`mypy_error.py`):\r\n\r\n```\r\nfrom numbers import Number\r\n\r\ndef is_very_large(x: Number):\r\n return x > 9000\r\n```\r\n\r\nSample 2 (`mypy_error2.py`):\r\n\r\n```\r\nfrom numbers import Number\r\n\r\ndef is_foo(data: dict):\r\n x = data[\"x\"]\r\n if isinstance(x, Number) and x \u003c 9000:\r\n return True\r\n else:\r\n return False\r\n```\r\n\r\nNote: Running `mypy` on Sample 2 succeeds if the `dict` annotation is removed from `data` or if the first two lines of the function are replaced with `def is_foo(x):`.\r\n\r\n* What is the actual behavior/output?\r\n\r\n```\r\nmypy_error2.py:5: error: Unsupported operand types for > (\"int\" and \"Number\")\r\nmypy_error.py:4: error: Unsupported operand types for \u003c (\"int\" and \"Number\")\r\nFound 2 errors in 2 files (checked 2 source files)\r\n```\r\n\r\nNote that the comparison operators shown in the error messages are the opposite of what appears in the code!\r\n\r\n* What is the behavior/output you expect? **No errors, as int and Number should be fully comparable**\r\n* What are the versions of mypy and Python you are using? **mypy 0.770, Python 3.7.6**\r\n Do you see the same issue after installing mypy from Git master? **Yes (commit 11c6888)**\r\n* What are the mypy flags you are using? **None**","author":{"url":"https://github.com/jwodder","@type":"Person","name":"jwodder"},"datePublished":"2020-03-20T20:47:25Z","url":"https://github.com/python/mypy/issues/8566"}
| 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:9ba4ad08-d500-8849-6607-eac74b00aa10 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9970:1A3D7F:2A4E16A:37814DA:6B000A54 |
| html-safe-nonce | fbc766ed8d5baddfc9b5d7bba102849cc2762209b03f0ac25252d50ee81153e3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OTcwOjFBM0Q3RjoyQTRFMTZBOjM3ODE0REE6NkIwMDBBNTQiLCJ2aXNpdG9yX2lkIjoiMTE1MTExMDYyMzYzNTk2NjU0OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ecabd0168d919c74415505fc43d41e4f4b1f6280f5cf51144453ebfafe73446c |
| hovercard-subject-tag | issue:585319181 |
| 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/8566/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ea43ce71b7d4744c7de9cef2236ca1233fe1479a1bf747231c63d5fe1c5c9fd5/python/mypy/issues/8566 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ea43ce71b7d4744c7de9cef2236ca1233fe1479a1bf747231c63d5fe1c5c9fd5/python/mypy/issues/8566 |
| og:image:alt | Are you reporting a bug, or opening a feature request? Bug Please insert below the code you are checking with mypy. Sample 1 (mypy_error.py): from numbers import Number def is_very_large(x: Number)... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jwodder |
| 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