go-python / gopy

gopy generates a CPython extension module from a go package.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: how to define python-compatible function

hy9be opened this issue · comments

commented

isPyCompatFunc seems to indicate the decision of
not supporting variadic functions
https://github.com/go-python/gopy/blob/master/bind/symbols.go#L156-L159

not supporting 3 or more than 3 return values
https://github.com/go-python/gopy/blob/master/bind/symbols.go#L178-L180

But both variadic functions and returning 3 values in functions are possible in Python3. Curious to know what are our criteria for "python-compatible" function.

it is all just about dealing with the different cases -- anything should be doable. It was a lot easier to get everything working without taking on those rarer cases. but certainly it would be nice -- I would especially like more return values as that is relatively common. PR's welcome :)

check out bind/gen_func.go for relevant code.

commented

got it. thanks @rcoreilly. i will see what i can do.

variadic functions has been added by @nishantsharma -- just about to release that.