Make `PyObject` parametric?
- Dominant language
- Julia
- Stars
- 1.5k
- Forks
- 186
- PR merge metrics
- No merged PRs in 30d
Description
Thinking about conversion between Julia and Python values and semantics, I wonder if we could make `PyObject` parametric, so make it `PyObject{P <: PyConversionPolicy}` where `P` encodes how we want to interpret the object.
For example, `PyObject{Nice}` would be equivalent to `PyObject` as it is now, with user-friendly automatic conversions. `PyObject{Raw}` would perform no automatic conversion at all, which would be useful for wrapping Python packages into Julia, where complete control is required. Other possibilities could be `PyObject{Numpy}` which converts Julia arrays to numpy arrays instead of to lists, for example.
This policy parameter would be inherited in a natural way, so operations on objects with the same policy produce an object with that policy.
I don't know if the effort to implement this would be worth it, since you can already achieve the same things using PyCall's clunkier syntax, but I just wanted to gather opinions and suggestions.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.