Go 语言编写 CPython 扩展 goPy

码农软件 · 软件分类 · Python开发工具 · 2019-11-12 21:57:01

软件介绍

goPy 是一个新的开源项目,实现了用 Go 语言来编写 CPython 扩展。

示例代码:

package simple

import (
	"fmt"
	"gopy"
)

func example(args *py.Tuple) (py.Object, error) {
	fmt.Printf("simple.example: %v\n", args)
	py.None.Incref()
	return py.None, nil
}

func init() {
	methods := []py.Method{
		{"example", example, "example function"},
	}

	_, err := py.InitModule("simple", methods)
	if err != nil {
		panic(err)
	}
}
编译方法:
> gopy pymodule.go
使用方法:
import simple

simple.example("hello", {123: True})
输出结果:
simple.example: [hello map[123:true]]

本文地址:https://codercto.com/soft/d/18860.html

Approximation Algorithms

Approximation Algorithms

Vijay V. Vazirani / Springer / 2001-07-02 / USD 54.95

'This book covers the dominant theoretical approaches to the approximate solution of hard combinatorial optimization and enumeration problems. It contains elegant combinatorial theory, useful and inte......一起来看看 《Approximation Algorithms》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

URL 编码/解码
URL 编码/解码

URL 编码/解码