Title: Other uses of annotations · Issue #26 · python/typing · GitHub
Open Graph Title: Other uses of annotations · Issue #26 · python/typing
X Title: Other uses of annotations · Issue #26 · python/typing
Description: Currently the proposal suggests a dictionary-based syntax for allowing the arbitrary annotations currently used in Python 3 to coexist with type annotations (https://github.com/ambv/typehinting/blob/master/pep-NNNN.txt#L194): def notify_...
Open Graph Description: Currently the proposal suggests a dictionary-based syntax for allowing the arbitrary annotations currently used in Python 3 to coexist with type annotations (https://github.com/ambv/typehinting/blo...
X Description: Currently the proposal suggests a dictionary-based syntax for allowing the arbitrary annotations currently used in Python 3 to coexist with type annotations (https://github.com/ambv/typehinting/blo...
Mail addresses
notifications@github.com
notifications@github.com
Opengraph URL: https://github.com/python/typing/issues/26
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Other uses of annotations","articleBody":"Currently the proposal suggests a dictionary-based syntax for allowing the arbitrary annotations currently used in Python 3 to coexist with type annotations (https://github.com/ambv/typehinting/blob/master/pep-NNNN.txt#L194):\n\n```\ndef notify_by_email(employees: {'type': List[Employee], 'min_size': 1, 'max_size': 100}): ...\n```\n\nThis meshes well with existing usage if the existing non-type annotation is already a dictionary, but if it's some other kind of value it forces additional refactoring. Maybe instead, `typing` could provide a `TaggedType` or similar class, which cleanly separates type information from other information that the programmer wants in their annotations:\n\n```\ndef notify_by_email(employees: TaggedType(List[Employee], {'min_size': 1, 'max_size': 100}): ...\nor\ndef notify_by_email(employees: TaggedType(List[Employee], 'list of employees to be notified')): ...\n```\n\nThe first argument is always a type, and the second argument is any arbitrary value.\n\nThis would also free up dictionaries for possibly representing structural types/protocols (see #11).\n","author":{"url":"https://github.com/mvitousek","@type":"Person","name":"mvitousek"},"datePublished":"2014-11-07T00:45:09Z","url":"https://github.com/python/typing/issues/26"}
| 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:2cb12b7c-f7b2-301b-f5eb-ed5d8c6dbc36 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AB8E:1FEE07:D9EFEE:11D4D44:6AFFFA52 |
| html-safe-nonce | b56e27634d4fb6f4f1148281b5b336f05c6faa9b1e342c341c9d855357997584 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQjhFOjFGRUUwNzpEOUVGRUU6MTFENEQ0NDo2QUZGRkE1MiIsInZpc2l0b3JfaWQiOiIyNzM5MTU0NTU2MzMwOTY1NTg2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | b0e4c5c74482b370f199ab9af6429de94f2eec90221b3c8134de0d2f27370c21 |
| hovercard-subject-tag | issue:48034614 |
| 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/26/issue_layout |
| twitter:image | https://opengraph.githubassets.com/68dee040cb0f93bea104dca3e1f4c98e4b936c5eebe3df837f3ee7f943724bff/python/typing/issues/26 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/68dee040cb0f93bea104dca3e1f4c98e4b936c5eebe3df837f3ee7f943724bff/python/typing/issues/26 |
| og:image:alt | Currently the proposal suggests a dictionary-based syntax for allowing the arbitrary annotations currently used in Python 3 to coexist with type annotations (https://github.com/ambv/typehinting/blo... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mvitousek |
| 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