Binary operators (+-/*) don't auto convert to Julia Types
- Vorherrschende Sprache
- Julia
- Sterne
- 1.5k
- Forks
- 186
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
```
julia> using PyCall
julia> np=pyimport("numpy")
julia> a=PyCall.NpyArray(rand(3,2), false)
PyObject array([[0.82703672, 0.52055539],
[0.33942729, 0.33577722],
[0.49147636, 0.67564576]])
julia> np.exp(a) # autoconverts to a julia type
3×2 Array{Float64,2}:
2.28653 1.68296
1.40414 1.39903
1.63473 1.9653
julia> a * 2 # does not auto convert
PyObject array([[1.65407344, 1.04111078],
[0.67885458, 0.67155445],
[0.98295273, 1.35129152]])
```
This is because in [pyoperators.jl](https://github.com/JuliaPy/PyCall.jl/blob/1d0d17d4095962613fd97021407bd10a9a51c015/src/pyoperators.jl#L11) a PyObject is returned.
Maybe to be consistent with other function calls a `convert(PyAny, ...)` should be added?
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Start with src/pyoperators.jl at the linked operator definitions and reproduce the Julia, PyCall, and NumPy examples from the issue. Compare binary-operator behavior with np.exp and verify that the reported operators produce the expected Julia-converted result.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- julia, numpy, python
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100