4 ms·
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
by icebraining 12y ago
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 http://www.cs.sfu.ca/~cameron/Teaching/383/PassByName.html