Python and Java parameter passing
This question already has an answer here:
Yes Python seems to be equivalent to Java in this respect. From http://learnpython.pbworks.com/w/page/15956522/Assignment :
But you must be careful about what is meant by "changes to parameters". Assigning a new value to a parameter name (inside the function, a parameter is just a local variable) does not change the original object--it only rebinds the local variable to a new object.
So, Python passes "object references" "by value".
链接地址: http://www.djcxy.com/p/20830.html上一篇: 如果没有指针,我可以将引用作为Python中的参数传递吗?
下一篇: Python和Java参数传递