go-python / go-python/gopy

support multiple return values using slice?

Đang mở
#235 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Go
Star
2.3k
Fork
136
Merge trung bình
14 phút
Pull request đã merge (30 ngày)
2

Mô tả

It should be possible in theory to support multiple return values from Go functions, constructing a []handle slice or something like that. The main problem would be supporting any kind of mix of basic value types (int, float etc) and objects requiring handles -- we don't have handles for values.. And, not sure about how pybindgen works with these -- it is targeted toward C / C++ which doesn't support multiple return types, so presumably it just ends up being a single opaque slice object return value, and it is up to the python user to decode the values properly.

Probably it would make the most sense to only support homogenous basic return values -- multiple int's floats etc. This is likely to be a very small subset of functions -- so far I have just written a few *Py methods that do this manually.

Note that the common case of an additional error return value is handled using a Python exception, instead of returning the error, so this would continue in any case.

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

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.