Title: Allow specifying a default for omitted type parameters · Issue #307 · python/typing · GitHub
Open Graph Title: Allow specifying a default for omitted type parameters · Issue #307 · python/typing
X Title: Allow specifying a default for omitted type parameters · Issue #307 · python/typing
Description: Take the following class: class Base: pass class Derived(Base): pass T = TypeVar('T', bound=Base) class MyType(Generic[T]): pass myvar: MyType = None # type of `myvar` is `MyType[Any]` My idea is to allow for some way to specify a defaul...
Open Graph Description: Take the following class: class Base: pass class Derived(Base): pass T = TypeVar('T', bound=Base) class MyType(Generic[T]): pass myvar: MyType = None # type of `myvar` is `MyType[Any]` My idea is t...
X Description: Take the following class: class Base: pass class Derived(Base): pass T = TypeVar('T', bound=Base) class MyType(Generic[T]): pass myvar: MyType = None # type of `myvar` is `MyType[Any]` My i...
Opengraph URL: https://github.com/python/typing/issues/307
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Allow specifying a default for omitted type parameters","articleBody":"Take the following class:\n\n``` python\nclass Base: pass\nclass Derived(Base): pass\n\nT = TypeVar('T', bound=Base)\nclass MyType(Generic[T]):\n pass\n\nmyvar: MyType = None # type of `myvar` is `MyType[Any]`\n```\n\nMy idea is to allow for some way to specify a default _other_ than any when the parameters are omitted. For example:\n\n``` python\nclass Base: pass\nclass Derived(Base): pass\n\nT = TypeVar('T', bound=Base, default=Base)\nclass MyType(Generic[T]):\n pass\n\nmyvar: MyType = None # type of `myvar` is `MyType[Base]`\n```\n\nor (I know this is invalid syntax, but it's the idea that counts):\n\n``` python\nclass Base: pass\nclass Derived(Base): pass\n\nT = TypeVar('T', bound=Base)\nclass MyType(Generic[T, default=Base]):\n pass\n\nmyvar: MyType = None # type of `myvar` is `MyType[Base]`\n```\n","author":{"url":"https://github.com/refi64","@type":"Person","name":"refi64"},"datePublished":"2016-10-24T22:32:11Z","url":"https://github.com/python/typing/issues/307"}
| 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:6817337a-209d-a7d9-c954-d049ded3529f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9136:34D604:14B580E:1B3FDD5:6B0016B1 |
| html-safe-nonce | 1918ca3cc5a29da5949c3292dca7d58d0b6284d6969d53a05f69d73ae167f6ba |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MTM2OjM0RDYwNDoxNEI1ODBFOjFCM0ZERDU6NkIwMDE2QjEiLCJ2aXNpdG9yX2lkIjoiNTc1NzY1MDMyNjM0OTk0NDQ5NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 037dd0d4ad70317f40af9041f387e134e87dfe719c95aaf1e8e995dd150b7e2b |
| hovercard-subject-tag | issue:184972143 |
| 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/307/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4357c28223323f83a2083d915e8c206faa5c31e8f59d39b6c73a0166d5de6831/python/typing/issues/307 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4357c28223323f83a2083d915e8c206faa5c31e8f59d39b6c73a0166d5de6831/python/typing/issues/307 |
| og:image:alt | Take the following class: class Base: pass class Derived(Base): pass T = TypeVar('T', bound=Base) class MyType(Generic[T]): pass myvar: MyType = None # type of `myvar` is `MyType[Any]` My idea is t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | refi64 |
| 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