path = [[0, 1, 0, 0],
[0, 0, 1, 1],
[0, 0, 0, 1],
[1, 0, 0, 0]]
print [hex(id(path[0])),hex(id(path[1])), hex(id(path[2]))], id(path[1])-id(path[0]),id(path[2]) -id(path[1])
path[1] = [0,0, 0, 0]
print path
print [hex(id(path[0])),hex(id(path[1])), hex(id(path[2]))], id(path[1])-id(path[0]),id(path[2]) -id(path[1])
这是python 2.7,CPython。结果示例:
['0x107d05638', '0x107cefb90', '0x107cef7e8'] -88744 -936
[[0, 1, 0, 0], [0, 0, 0, 0], [0, 0, 0, 1], [1, 0, 0, 0]]
['0x107d05638', '0x107cef8c0', '0x107cef7e8'] -89464 -216
谢谢你。