Allow multiline to work better
- Ngôn ngữ chính
- Julia
- Star
- 1.5k
- Fork
- 186
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
Is that possible? A minimal example (getting rid of he function, down to just the tuple, it would have returned):
```
(A, B) = py"""
(1, 3)
"""
ERROR: MethodError: no method matching iterate(::Nothing)
Closest candidates are:
iterate(::Pkg.Resolve.NodePerm, ::Any...) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Pkg/src/Resolve/maxsum.jl:228
iterate(::PyObject) at /home/pharaldsson_sym/.julia/packages/PyCall/l64G5/src/pyiterator.jl:81
iterate(::PyObject, ::Any) at /home/pharaldsson_sym/.julia/packages/PyCall/l64G5/src/pyiterator.jl:81
...
Stacktrace:
[1] indexed_iterate(::Nothing, ::Int64) at ./tuple.jl:84
[2] top-level scope at /home/pharaldsson_sym/.julia/packages/PyCall/l64G5/src/pyeval.jl:232
```
You can do:
```
py"""
some_func(foo, bar)
"""
```
even if that func is calling Octave for me as seen below, and I just couldn't access the result.
I could have sworn I had done multiline with a tuple before, but actually I guess I was doing slightly different.
E.g. I can:
```
julia> (vintage0, vintage1, vintage2, vintage6m) = py"oc.get_vintage_months($vintageNow, nout=4)"
4-element Array{Float64,1}:
737911.0
737942.0
737982.5481348842
737790.0
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Start with the multiline py-string handling in pyeval.jl, especially the path referenced at line 232, and reproduce the tuple-assignment example from the issue. Compare it with the working multiline function call and single-line tuple examples. Done means a multiline Python expression returning a tuple can be assigned and iterated without producing Nothing.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- julia, python
- Lĩnh vực
- api
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100