JuliaPy / JuliaPy/PythonCall.jl

Support more of abstract array interface

Open
#462 11 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Julia
Stars
1.1k
Forks
86
Avg merge
1d 22h
Merged PRs (30d)
3

Description

Currently `similar` will return an array of a different type:

```python
from juliacall import Main as jl
import numpy as np

x = np.random.randn(5)
y = jl.similar(x)

print(jl.typeof(x))
# PyArray{Float64, 1, true, true, Float64}
print(jl.typeof(y))
# Vector{Float64}
```

This can introduce some type instabilities in libraries due to the assumption that container type is preserved by `similar`.

I guess we just need the "optional methods" from here: https://docs.julialang.org/en/v1/manual/interfaces/#man-interface-array

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.