Title: Multiple inheritance triggers issues that cannot be resolved · Issue #4335 · python/mypy · GitHub
Open Graph Title: Multiple inheritance triggers issues that cannot be resolved · Issue #4335 · python/mypy
X Title: Multiple inheritance triggers issues that cannot be resolved · Issue #4335 · python/mypy
Description: When using multiple inheritance, the mixing of arguments to different base classes triggers warnings that cannot be resolved. from typing import Any, Dict, Optional, Sequence, Tuple class BaseClass(object): def __init__(self, foo: str, *...
Open Graph Description: When using multiple inheritance, the mixing of arguments to different base classes triggers warnings that cannot be resolved. from typing import Any, Dict, Optional, Sequence, Tuple class BaseClass...
X Description: When using multiple inheritance, the mixing of arguments to different base classes triggers warnings that cannot be resolved. from typing import Any, Dict, Optional, Sequence, Tuple class BaseClass...
Opengraph URL: https://github.com/python/mypy/issues/4335
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Multiple inheritance triggers issues that cannot be resolved","articleBody":"When using multiple inheritance, the mixing of arguments to different base classes triggers warnings that cannot be resolved.\r\n\r\n```\r\nfrom typing import Any, Dict, Optional, Sequence, Tuple\r\n\r\nclass BaseClass(object):\r\n def __init__(self, foo: str, *args: Sequence[Any], **kwargs: Dict[str, Any]) -> None:\r\n self.foo = foo\r\n super().__init__(*args, **kwargs)\r\n\r\nclass Mixin(object):\r\n def __init__(self, bar: str, baz: Optional[str]=None, *args: Sequence[Any], **kwargs: Dict[str, Any]) -> None:\r\n self.bar = bar\r\n self.baz = baz or 'baz2'\r\n super().__init__(*args, **kwargs)\r\n\r\nclass Derived(BaseClass, Mixin):\r\n def __init__(self, foo: str, bar: str, other: str, *args: Sequence[Any], **kwargs: Dict[str, Any]) -> None:\r\n self.other = other\r\n super().__init__(foo=foo, bar=bar, *args, **kwargs)\r\n\r\nd = Derived('foo', 'bar', 'other')\r\n\r\nprint(d.foo)\r\nprint(d.bar)\r\nprint(d.other)\r\nprint(d.baz)\r\n```\r\n\r\n```\r\n% python3.6 test.py \r\nfoo\r\nbar\r\nother\r\nbaz2\r\n```\r\n\r\n```\r\n% mypy test.py \r\ntest.py:7: error: Too many arguments for \"__init__\" of \"object\"\r\ntest.py:13: error: Too many arguments for \"__init__\" of \"object\"\r\ntest.py:18: error: \"__init__\" of \"BaseClass\" gets multiple values for keyword argument \"foo\"\r\ntest.py:18: error: Argument 1 to \"__init__\" of \"BaseClass\" has incompatible type *Tuple[Sequence[Any], ...]; expected \"str\"\r\ntest.py:18: error: Argument 4 to \"__init__\" of \"BaseClass\" has incompatible type **Dict[str, Dict[str, Any]]; expected \"str\"\r\ntest.py:18: error: Argument 4 to \"__init__\" of \"BaseClass\" has incompatible type **Dict[str, Dict[str, Any]]; expected Sequence[Any]\r\ntest.py:18: error: Argument 3 to \"__init__\" of \"BaseClass\" has incompatible type \"str\"; expected Dict[str, Any]\r\n```\r\n\r\n```\r\n% mypy --version\r\nmypy 0.521\r\n```\r\n\r\n```\r\n% python3.6 --version\r\nPython 3.6.3\r\n```","author":{"url":"https://github.com/jmh045000","@type":"Person","name":"jmh045000"},"datePublished":"2017-12-07T14:49:39Z","url":"https://github.com/python/mypy/issues/4335"}
| 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:079a16c1-b969-31c0-bcd9-1a61144a6484 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8F1E:2A087:41974A:57E040:6B002C73 |
| html-safe-nonce | 79412ac06468ee3c5f4ee354a1311fdb61009fe1231abbacf5e2f5f44e975e76 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RjFFOjJBMDg3OjQxOTc0QTo1N0UwNDA6NkIwMDJDNzMiLCJ2aXNpdG9yX2lkIjoiMzYwMjY0NjE4NjMxOTY4Njc3MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ae89e27be47e563e523a0db7162c27f22610d5ccdb05c122b77bd967efd9f598 |
| hovercard-subject-tag | issue:280156889 |
| 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/4335/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d4fd8b90083fdcf0062046a94c921ac27721bfc4f50997a3a11e5fa6adc59ee3/python/mypy/issues/4335 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d4fd8b90083fdcf0062046a94c921ac27721bfc4f50997a3a11e5fa6adc59ee3/python/mypy/issues/4335 |
| og:image:alt | When using multiple inheritance, the mixing of arguments to different base classes triggers warnings that cannot be resolved. from typing import Any, Dict, Optional, Sequence, Tuple class BaseClass... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jmh045000 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| 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 | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width