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: 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:e44219c7-4dd5-f7f8-eeb2-5fb6af1406e9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DD84:14E806:8D600:BA42E:6A62887B |
| html-safe-nonce | c1b64bb8d654e45da34dc34e45628335202507ffd12a159a09f5af3bded45060 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERDg0OjE0RTgwNjo4RDYwMDpCQTQyRTo2QTYyODg3QiIsInZpc2l0b3JfaWQiOiIyMDIyMTMzOTg1NTc0MDI5NDM1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 086a3f118d2f2b0276208b498695a9f6efc25ad684894fedc356d890bf8aaebe |
| 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 | 7a4ef49a11a2c05de16a801b29c54a151d2e3262d6fd17381ca13b5ae25dda8f |
| 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 | 97b18c8f1d2683a31995fd6e802daf9bf0d4d3f0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width