Title: Bad typing for Python 2.7 with `unicode_literals` · Issue #5098 · python/mypy · GitHub
Open Graph Title: Bad typing for Python 2.7 with `unicode_literals` · Issue #5098 · python/mypy
X Title: Bad typing for Python 2.7 with `unicode_literals` · Issue #5098 · python/mypy
Description: Consider: from __future__ import unicode_literals import sys print(sys.modules['sys']) mypy --py2 unicode_literals.py results in: unicode_literals.py:4: error: Invalid index type "unicode" for "Dict[str, Any]"; expected type "str" Howeve...
Open Graph Description: Consider: from __future__ import unicode_literals import sys print(sys.modules['sys']) mypy --py2 unicode_literals.py results in: unicode_literals.py:4: error: Invalid index type "unicode" for "Dic...
X Description: Consider: from __future__ import unicode_literals import sys print(sys.modules['sys']) mypy --py2 unicode_literals.py results in: unicode_literals.py:4: error: Invalid index type "unic...
Opengraph URL: https://github.com/python/mypy/issues/5098
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bad typing for Python 2.7 with `unicode_literals`","articleBody":"Consider:\r\n```py\r\nfrom __future__ import unicode_literals\r\nimport sys\r\n\r\nprint(sys.modules['sys'])\r\n```\r\n\r\n`mypy --py2 unicode_literals.py` results in:\r\n```\r\nunicode_literals.py:4: error: Invalid index type \"unicode\" for \"Dict[str, Any]\"; expected type \"str\"\r\n```\r\n\r\nHowever, `python2.7 unicode_literals.py` results in:\r\n```\r\n\u003cmodule 'sys' (built-in)>\r\n```","author":{"url":"https://github.com/ikonst","@type":"Person","name":"ikonst"},"datePublished":"2018-05-23T01:25:51Z","url":"https://github.com/python/mypy/issues/5098"}
| 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:9df823c2-ef53-1037-e8cf-a00761ced760 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E892:3FDF0C:10B71B9:166433C:6B005E03 |
| html-safe-nonce | ce4cb222336ccdc4d006ba1af6ad778400fd90729b6a6e503884aa5561467bd3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODkyOjNGREYwQzoxMEI3MUI5OjE2NjQzM0M6NkIwMDVFMDMiLCJ2aXNpdG9yX2lkIjoiNTM2MjU0NDAwMTE4NDQ1NjE5NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 694b48c0b2fdb15a38332475fbed62d037721c82f73ea099d40cf82a2444d620 |
| hovercard-subject-tag | issue:325516692 |
| 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/5098/issue_layout |
| twitter:image | https://opengraph.githubassets.com/419ebcbaee5e6b37b7836dfffb9e8199395a3ffc5d5f03b6c755d46e09acf008/python/mypy/issues/5098 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/419ebcbaee5e6b37b7836dfffb9e8199395a3ffc5d5f03b6c755d46e09acf008/python/mypy/issues/5098 |
| og:image:alt | Consider: from __future__ import unicode_literals import sys print(sys.modules['sys']) mypy --py2 unicode_literals.py results in: unicode_literals.py:4: error: Invalid index type "unicode" for "Dic... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ikonst |
| hostname | github.com |
| expected-hostname | github.com |
| None | 29be975efff6507a5d135de9c7d634cf7ff8f0c55222a64386ab3202209aaf73 |
| 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 | eacd927ba6112e3b01ba99c762bd699a4a4f5df7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width