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: patch-diff.githubusercontent.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:aac55167-43f1-5b1b-7c9d-b1b7a2b23a86 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D0A0:3C62DE:85923D8:B2511DC:696E1466 |
| html-safe-nonce | affb27697ffc8ce755d99005af92ed6f732e836183faf60ccba840d5f4504aac |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMEEwOjNDNjJERTo4NTkyM0Q4OkIyNTExREM6Njk2RTE0NjYiLCJ2aXNpdG9yX2lkIjoiMjA1MDg4OTgwNTIxNzAxMDc5MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5a38655fbfdb77bc84ff061aa60ded9d6c9c9fff56c8677c3168ed69c48412d1 |
| 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 | 1a7d6d739bf034e67486b9f97a31887ca30302b72a0acac49b6bcddff34356d7 |
| 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 | 87d7872ec7094ed247923539669aabda9230966f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width