Title: Deriving from .NET types in Python does not inherit constructor · Issue #1945 · pythonnet/pythonnet · GitHub
Open Graph Title: Deriving from .NET types in Python does not inherit constructor · Issue #1945 · pythonnet/pythonnet
X Title: Deriving from .NET types in Python does not inherit constructor · Issue #1945 · pythonnet/pythonnet
Description: from System import Object class L1(Object): __namespace__ = 'TestNS' def __init__(self): super().__init__() print('42') class L2(L1): __namespace__ = 'TestNS' o = L2() # 42 is not printed Workaround Explicitly redefine __init__ in L2: cl...
Open Graph Description: from System import Object class L1(Object): __namespace__ = 'TestNS' def __init__(self): super().__init__() print('42') class L2(L1): __namespace__ = 'TestNS' o = L2() # 42 is not printed Workaroun...
X Description: from System import Object class L1(Object): __namespace__ = 'TestNS' def __init__(self): super().__init__() print('42') class L2(L1): __namespace__ = 'TestNS' o = L2() # 42 ...
Opengraph URL: https://github.com/pythonnet/pythonnet/issues/1945
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Deriving from .NET types in Python does not inherit constructor","articleBody":"```python\r\nfrom System import Object\r\n\r\nclass L1(Object):\r\n __namespace__ = 'TestNS'\r\n def __init__(self):\r\n super().__init__()\r\n print('42')\r\n\r\nclass L2(L1):\r\n __namespace__ = 'TestNS'\r\n\r\no = L2() # 42 is not printed\r\n```\r\n\r\n## Workaround\r\nExplicitly redefine `__init__` in `L2`:\r\n\r\n```python\r\nclass L3(L1):\r\n __namespace__ = 'TestNS'\r\n def __init__(self):\r\n super().__init__()\r\n\r\no = L3() # prints '42'\r\n```","author":{"url":"https://github.com/lostmsu","@type":"Person","name":"lostmsu"},"datePublished":"2022-09-17T00:20:12.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1945/pythonnet/issues/1945"}
| 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:8604aee5-0bff-a7b0-f8c0-6e1dcb7ff211 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A770:203DA6:133485E:19B7B6F:69705F8B |
| html-safe-nonce | dfd57fbac241fe10892a946448c73428471e545842f7eec95034fe9d6260b335 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNzcwOjIwM0RBNjoxMzM0ODVFOjE5QjdCNkY6Njk3MDVGOEIiLCJ2aXNpdG9yX2lkIjoiMjY0MTE3NDA0NzIwMTcxNDA1OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4c245c9a878753e509958e0ec125813028d31ab62156373b771dafaf85207717 |
| hovercard-subject-tag | issue:1376607372 |
| 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/pythonnet/pythonnet/1945/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bb07b761a9d0a9596fbf9c3ac6488a4687f84a9bbc30e5097d163e4c56f67b46/pythonnet/pythonnet/issues/1945 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bb07b761a9d0a9596fbf9c3ac6488a4687f84a9bbc30e5097d163e4c56f67b46/pythonnet/pythonnet/issues/1945 |
| og:image:alt | from System import Object class L1(Object): __namespace__ = 'TestNS' def __init__(self): super().__init__() print('42') class L2(L1): __namespace__ = 'TestNS' o = L2() # 42 is not printed Workaroun... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lostmsu |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9920a62ba22d06470388e2904804fb7e5ec51c9e35f81784e9191394c74b2bd2 |
| turbo-cache-control | no-preview |
| go-import | github.com/pythonnet/pythonnet git https://github.com/pythonnet/pythonnet.git |
| octolytics-dimension-user_id | 6050430 |
| octolytics-dimension-user_login | pythonnet |
| octolytics-dimension-repository_id | 14748123 |
| octolytics-dimension-repository_nwo | pythonnet/pythonnet |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 14748123 |
| octolytics-dimension-repository_network_root_nwo | pythonnet/pythonnet |
| 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 | 7d6181066430cc06553c8396ca201e194ae33cb9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width