|
|
|
|
|
by moonchild
1372 days ago
|
|
Python is not call-by-reference. If it were, we would expect 2 to be printed below, but it is not: >>> def f(x):
... x = 2
>>> x = 1
>>> f(x)
>>> x
1
One might refer to r as being referentially transparent, or immutable (I don't know if it is--I am assuming). I would refer to python as using uniform reference semantics - http://metamodular.com/common-lisp-semantics.html |
|
If we capture a lambda before "x = 2", and then call it afterward, does it see an x which holds the original argument value or which holds 2?
In Lisps, this stuff is clear. Mostly. Except Common Lisp has some areas where it waffles: in some iteration constructs, implementations can bind a new variable or reuse the same one. Those choices are individually clear, though.