github.com/goplus/llgo@v0.8.3/py/_demo/callpy/call.go (about) 1 package main 2 3 import ( 4 "github.com/goplus/llgo/c" 5 "github.com/goplus/llgo/py" 6 ) 7 8 func main() { 9 py.Initialize() 10 py.SetProgramName(*c.Argv) 11 math := py.ImportModule(c.Str("math")) 12 sqrt := math.GetAttrString(c.Str("sqrt")) 13 sqrt2 := sqrt.CallOneArg(py.Float(2)) 14 c.Printf(c.Str("sqrt(2) = %f\n"), sqrt2.Float64()) 15 sqrt2.DecRef() 16 sqrt.DecRef() 17 math.DecRef() 18 py.Finalize() 19 }