Make `PyObject` parametric?
- Vorherrschende Sprache
- Julia
- Sterne
- 1.5k
- Forks
- 186
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.