Re:Java is Pass-by-Value, Dammit
by _ZeD_ on Sunday March 22, 2015 @03:43AM
(#9245972)
Storically, python devs says the python language use "pass-by-name"
[ Parent
| on HN ]
Re:Java is Pass-by-Value, Dammit
by icebraining on Sunday March 22, 2015 @06:13AM
(#9246237)
How so? Reading [1] on pass-by-name, I don't see how it applies to Python, which evaluates the function arguments before passing them.
The example given would be, in Python,
def double(x):
x *= 2
a = [4]
double(a[0])
If Python was pass-by-name, a would now be [8], but it's actually still [4].[1] http://www.cs.sfu.ca/~cameron/Teaching/383/PassByName.html