Object Handle
Demonstrates Python object handles — keeping Python objects in-process and referencing them by numeric ID across calls. Handles avoid serializing the entire object on every call.
Key Points
ref()returns aPythonHandlewithout serializing the objecthandle.call("method", args...)— invoke methods on the held objecthandle.getAttr("name")— read attributeshandle.refId()/handle.pythonType()— inspect the handlehandle.release()/handle.close()— explicit release (AutoCloseable)- Handles are automatically released when PythonEmbed is closed