Title: Support inheriting Go objects in Python and overriding methods/attributes? · Issue #247 · go-python/gpython · GitHub
Open Graph Title: Support inheriting Go objects in Python and overriding methods/attributes? · Issue #247 · go-python/gpython
X Title: Support inheriting Go objects in Python and overriding methods/attributes? · Issue #247 · go-python/gpython
Description: I am exploring gpython to embed Python scripting in a Go project. I have the following question regarding object interoperability: Is it possible to define a Python class that inherits from a Go object exposed to gpython? Can such a Pyth...
Open Graph Description: I am exploring gpython to embed Python scripting in a Go project. I have the following question regarding object interoperability: Is it possible to define a Python class that inherits from a Go ob...
X Description: I am exploring gpython to embed Python scripting in a Go project. I have the following question regarding object interoperability: Is it possible to define a Python class that inherits from a Go ob...
Opengraph URL: https://github.com/go-python/gpython/issues/247
X: @github
Domain: redirect.github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support inheriting Go objects in Python and overriding methods/attributes?","articleBody":"I am exploring gpython to embed Python scripting in a Go project. I have the following question regarding object interoperability:\n \n - Is it possible to define a Python class that inherits from a Go object exposed to gpython?\n - Can such a Python subclass override methods or add new attributes on top of the Go object?\n \nFor example, in Python I would like to do something like:\n```python\n# Hypothetical example\nclass PyVacation(MyGoVacation):\n def new_method(self):\n return \"Python override\"\n \n @property\n def new_attr(self):\n return \"Python attribute\"\n```\n\nCurrently, I am able to expose Go objects to gpython and call Go methods, but I am unsure if inheritance is supported.\n\nCould you clarify whether this is possible, and if not, are there recommended workarounds (e.g., composition or monkey-patching) to extend Go objects in Python?\n\nThank you for your help!","author":{"url":"https://github.com/IcyVizi","@type":"Person","name":"IcyVizi"},"datePublished":"2025-09-25T13:10:58.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/247/gpython/issues/247"}
| 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:5e13d782-df74-7eaf-c398-1598346bc1d7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E15E:386F6E:8C8122:C14C3F:6969E98F |
| html-safe-nonce | 57b76701aa508408c3cc4c2257ca8b8d486ff7289a449d825ab28fcfff8bca9a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMTVFOjM4NkY2RTo4QzgxMjI6QzE0QzNGOjY5NjlFOThGIiwidmlzaXRvcl9pZCI6Ijc3NjgwODU3ODU1NjU4NDk5OTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c248ffb350887590e47107b92189f72486ce4dd3370cff6ddac49246576ac0b7 |
| hovercard-subject-tag | issue:3453571030 |
| 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/go-python/gpython/247/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a11036259f8a31c22504623bfc978633e3c540e3f09450382495ebbfdea8b33b/go-python/gpython/issues/247 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a11036259f8a31c22504623bfc978633e3c540e3f09450382495ebbfdea8b33b/go-python/gpython/issues/247 |
| og:image:alt | I am exploring gpython to embed Python scripting in a Go project. I have the following question regarding object interoperability: Is it possible to define a Python class that inherits from a Go ob... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | IcyVizi |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| turbo-cache-control | no-preview |
| go-import | github.com/go-python/gpython git https://github.com/go-python/gpython.git |
| octolytics-dimension-user_id | 7604679 |
| octolytics-dimension-user_login | go-python |
| octolytics-dimension-repository_id | 143203535 |
| octolytics-dimension-repository_nwo | go-python/gpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 143203535 |
| octolytics-dimension-repository_network_root_nwo | go-python/gpython |
| 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 | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width