JuliaPy / JuliaPy/PythonCall.jl

Working with type instabilities, coming from PyJulia

オープン
#441 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Julia
スター
1.1k
フォーク
86
平均マージ
1日 22時間
マージ済み PR(30日)
3

説明

@cjdoris Is there an automatic way to force type conversions when passing Python objects to methods? Or, in other words, is there a way to automatically convert Python arguments to their Julia counterparts?

For example I am running into this issue right now when I pass a list of integers:

```python
>>> from juliacall import Main as jl
>>> jl.seval("f(x) = (@show typeof(x); nothing)")
Julia: f (generic function with 1 method)
>>> jl.f([1, 2, 3])
typeof(x) = PyList{Any}
```

which causes some issues as now `f` is unaware of the element type of this vector.

However, in PyJulia, arguments seem to somehow get converted automatically:

```python
>>> from julia import Main as jl
>>> jl.eval("f(x) = (@show typeof(x); nothing)")

>>> jl.f([1, 2, 3])
typeof(x) = Vector{Int64}
```

Is there a way to get this same behavior in PythonCall?

---

Possibly related to #439

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Start by comparing the PythonCall/juliacall behavior in the example with the PyJulia behavior, focusing on how Python lists are converted when calling Julia functions through Main. Define the intended conversion and type-stability behavior, including the shown list-of-integers case, then check the related discussion in #439 for context before identifying tests or entry points.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
julia, python
領域
backend
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。