go-python3 How to instantiate a python class #26
djxhhh
started this conversation in
Usage Discussions
Replies: 1 comment
-
one way would be to just write some Python code to instantiate the class and run it with PyRun_SimpleString. You can then use Python C-API functions to find the resulting PyObject in the root dict. Once you have it mapped to a Go variable you can i.e. read attributes or call methods. Most of this is outlined in this example. Your instantiated Python class is just a PyObject. https://github.com/christian-korneck/python-go/tree/master/py-bindings/outliers Another way: To instantiate a Python class the pure C-API way, this might help: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I don't know how to use go-python3 for class initialization
Beta Was this translation helpful? Give feedback.
All reactions