Title: How should we annotate functions that forward to their superclass? · Issue #1471 · python/typing · GitHub
Open Graph Title: How should we annotate functions that forward to their superclass? · Issue #1471 · python/typing
X Title: How should we annotate functions that forward to their superclass? · Issue #1471 · python/typing
Description: Consider this real code: from typing import SuperKwargs class InferenceManager(Generic[T]): @override def __init__(self, *, default_trajectory: T, progress_manager: None | ProgressManager, wandb_run: None | Run ) -> None: super().__init_...
Open Graph Description: Consider this real code: from typing import SuperKwargs class InferenceManager(Generic[T]): @override def __init__(self, *, default_trajectory: T, progress_manager: None | ProgressManager, wandb_ru...
X Description: Consider this real code: from typing import SuperKwargs class InferenceManager(Generic[T]): @override def __init__(self, *, default_trajectory: T, progress_manager: None | ProgressManager, wandb_ru...
Opengraph URL: https://github.com/python/typing/issues/1471
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"How should we annotate functions that forward to their superclass?","articleBody":"Consider this real code:\r\n```python\r\nfrom typing import SuperKwargs\r\n\r\nclass InferenceManager(Generic[T]):\r\n @override\r\n def __init__(self,\r\n *,\r\n default_trajectory: T,\r\n progress_manager: None | ProgressManager,\r\n wandb_run: None | Run\r\n ) -> None:\r\n super().__init__()\r\n self._progress_manager = progress_manager\r\n self._results: list[T] = []\r\n self._trajectory = default_trajectory\r\n self._wandb_run = wandb_run\r\n\r\n\r\nclass TrainingInferenceManager(InferenceManager[RLTrainingResult]):\r\n def __init__(self, training_result: TrainingResult, **kwargs: SuperKwargs):\r\n self.training_result = training_result\r\n super().__init__(**kwargs)\r\n```\r\nIf we want full annotations for `TrainingInferenceManager.__init__`, we currently need to duplicate all of the superclass's parameters. I suggest adding `typing.SuperKwargs` that stands in place of them.\r\n\r\n(This could be made more complicated by allowing the child class to synthesize some of the parameters.)\r\n\r\nRelated: https://github.com/python/mypy/issues/8769","author":{"url":"https://github.com/NeilGirdhar","@type":"Person","name":"NeilGirdhar"},"datePublished":"2023-09-18T22:40:49Z","url":"https://github.com/python/typing/issues/1471"}
| 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:8cc04381-2cfd-4f0c-54f9-f6e8e78dab5d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D486:3AC034:1F725:2B93C:6B0019BF |
| html-safe-nonce | 30aca5e7b7675d6f01a1200a2c5677b7d5c6aa979e57564e60d0003dc0ec37e5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENDg2OjNBQzAzNDoxRjcyNToyQjkzQzo2QjAwMTlCRiIsInZpc2l0b3JfaWQiOiI1MDQxOTYzODU4MzQ0ODEwOTQzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 2414f99ac17f3f969893596b30402de56922b3dd238d697c7abc32d6b083be21 |
| hovercard-subject-tag | issue:1901854608 |
| 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/1471/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9f27e402a04b5f6aefacd7d18243031ec98fcc5da4fe08e43516a02494b921df/python/typing/issues/1471 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9f27e402a04b5f6aefacd7d18243031ec98fcc5da4fe08e43516a02494b921df/python/typing/issues/1471 |
| og:image:alt | Consider this real code: from typing import SuperKwargs class InferenceManager(Generic[T]): @override def __init__(self, *, default_trajectory: T, progress_manager: None | ProgressManager, wandb_ru... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | NeilGirdhar |
| 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