go-python / go-python/gopy

support multiple return values using slice?

未关闭
#235 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Go
星标
2.3k
派生
136
平均合并
14 分钟
30 天内合并 PR
2

描述

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.

贡献指南

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

调研方向

首先检查现有手写的、返回多个值的 *Py 方法,以及 Go 函数如何通过 pybindgen 暴露。定义受支持的同质基本值情况,以及如何验证普通值、handles 和现有的基于异常的错误返回约定是否完成。

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

评估

技术栈
go, python
领域
tooling
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

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