gpython is a part re-implementation / part port of the Python 3.4 interpreter to the Go language, "batteries not included".
It includes:
It does not include very many python modules as many of the core modules are written in C not python. The converted modules are:
Gpython is a Go program and comes as a single binary file.
Download the relevant binary from here: https://github.com/go-python/gpython/releases
Or alternatively if you have Go installed use
go get github.com/go-python/gpython
and this will build the binary in $GOPATH/bin
. You can then modify
the source and submit patches.
Gpython was written as a learning experiment to investigate how hard porting Python to Go might be. It turns out that all those C modules are a significant barrier to making a fully functional port.
The project works well enough to parse all the code in the python 3.4 distribution and to compile and run python 3 programs which don't depend on a module gpython doesn't support.
See the examples directory for some python programs which run with gpython.
Speed hasn't been a goal of the conversions however it runs pystone at about 20% of the speed of cpython. The pi test runs quicker under gpython as I think the Go long integer primitives are faster than the Python ones.
There are many directions this project could go in. I think the most
profitable would be to re-use the
grumpy runtime (which would mean
changing the object model). This would give access to the C modules
that need to be ported and would give grumpy access to a compiler and
interpreter (gpython does support eval
for instance).
I (@ncw) haven't had much time to work on gpython (I started it in 2013 and have worked on it very sporadically) so someone who wants to take it in the next direction would be much appreciated.
Lots!
This is licensed under the MIT licence, however it contains code which was ported fairly directly directly from the cpython source code under the (PSF LICENSE)[https://github.com/python/cpython/blob/master/LICENSE].
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。