在python与go语言是引用还是值传递解释

python代码
#!/usr/bin/env python2
print 'hello world'
a=10
b=a
print id(a)
print id(b)
执行结果    # 赋值后地址依然相同,说明是引用传递
[email protected]:~/Desktop$ ./Data-web.py 
hello world
41255040
41255040


go语言代码

package main
import "fmt"
var g int
var d int
func main()  {
	d = 10
	g=d
	fmt.Println(&g)
	fmt.Println(&d)
}

执行结果   #  地址明显不同,说明是值传递(注:go有特殊函数也是引用传递)

F:\mygo\src\file\test>go run circulation.go
0x575110
0x575108

以下是python引用传递图解 

 在python与go语言是引用还是值传递解释