JuliaPy / JuliaPy/PythonCall.jl

Support more of abstract array interface

未关闭
#462 11 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
Julia
星标
1.1k
派生
86
平均合并
1 天 22 小时
30 天内合并 PR
3

描述

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

贡献指南

这个仓库没有索引到贡献指南

调研方向

No implementation file or test is named. Reproduce the Python/Julia `similar` example from the issue, then read the linked Julia array-interface documentation and trace the existing `similar` handling in PythonCall.jl. Done means the relevant optional array-interface methods are supported and the example preserves the expected container type.

由索引模型根据 Issue 内容生成。

评估

技术栈
julia, python
领域
api, backend
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。