Title: Add NewType() to create simple unique types with zero runtime overhead · Issue #189 · python/typing · GitHub
Open Graph Title: Add NewType() to create simple unique types with zero runtime overhead · Issue #189 · python/typing
X Title: Add NewType() to create simple unique types with zero runtime overhead · Issue #189 · python/typing
Description: The description is best gleaned from the following mypy issue: python/mypy#1284 (comment) and following. We're going with option (A). Really brief example: from typing import NewType UserId = NewType('UserId', int) Now to the type checke...
Open Graph Description: The description is best gleaned from the following mypy issue: python/mypy#1284 (comment) and following. We're going with option (A). Really brief example: from typing import NewType UserId = NewTy...
X Description: The description is best gleaned from the following mypy issue: python/mypy#1284 (comment) and following. We're going with option (A). Really brief example: from typing import NewType UserId = N...
Opengraph URL: https://github.com/python/typing/issues/189
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add NewType() to create simple unique types with zero runtime overhead","articleBody":"The description is best gleaned from the following mypy issue: https://github.com/python/mypy/issues/1284#issuecomment-199021176 and following. We're going with option (A).\n\nReally brief example:\n\n``` python\nfrom typing import NewType\nUserId = NewType('UserId', int)\n```\n\nNow to the type checker UserId is a new type that's compatible with int, but converting an int to a UserId requires a special cast form, UserId(x). At runtime UserId instances are just ints (not a subclass!) and UserId() is a dummy function that just returns its argument.\n","author":{"url":"https://github.com/gvanrossum","@type":"Person","name":"gvanrossum"},"datePublished":"2016-03-21T16:19:29Z","url":"https://github.com/python/typing/issues/189"}
| 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:df6c68f3-624e-b495-e648-4b6236de2da1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C718:DD1C:1F515F0:2A75087:6B00199D |
| html-safe-nonce | 1dd0202efff1fc478bdf62638e74dd2a712b07a06ff4c733fa1f937aeca6682d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNzE4OkREMUM6MUY1MTVGMDoyQTc1MDg3OjZCMDAxOTlEIiwidmlzaXRvcl9pZCI6IjcyMDMwMzk1NDg4MjgyOTM1MzMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | e407830661380afa78e52f22d5ee9a630492a795dc3fead03590b61f70784365 |
| hovercard-subject-tag | issue:142398650 |
| 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/189/issue_layout |
| twitter:image | https://opengraph.githubassets.com/09e22d20d1043dd3a4753710c2a36bbb8da23b2751a6f0b8e76709bd263e27c9/python/typing/issues/189 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/09e22d20d1043dd3a4753710c2a36bbb8da23b2751a6f0b8e76709bd263e27c9/python/typing/issues/189 |
| og:image:alt | The description is best gleaned from the following mypy issue: python/mypy#1284 (comment) and following. We're going with option (A). Really brief example: from typing import NewType UserId = NewTy... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gvanrossum |
| hostname | github.com |
| expected-hostname | github.com |
| None | a2dd2291b1b13cc9c06f27ec92fa3dbaf34116fc24c9347b8539db61884c59f4 |
| 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 | 70121d4e855ee0bb7b75cf15d061d91f8863c0f8 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width