Binary operators (+-/*) don't auto convert to Julia Types
- Lenguaje dominante
- Julia
- Estrellas
- 1.5k
- Forks
- 186
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
```
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?
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- julia, numpy, python
- Área
- tooling
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100