JuliaPy / JuliaPy/PyCall.jl

Make `PyObject` parametric?

Aperta
#734 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Julia
Stelle
1.5k
Fork
186
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Start by reading the existing PyObject conversion behavior and the PyCall syntax the issue compares against. Clarify whether a PyConversionPolicy with Nice, Raw, and Numpy variants is wanted, including policy inheritance across operations; done would require agreement on the design and its conversion semantics.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
julia, numpy, python
Ambito
api
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.