passing by refference
Brian Quinlan
brian at sweetapp.com
Thu May 15 17:50:29 EDT 2003
> I don't know CLU but I suspect that CLU was/is call-by-value. The
> statement about mutations of arguments and cbv is striking -- it's
> just plain wrong. This is a remarkably powerful misconception.
> C array arguments can be mutated and yet C is pure call-by-value.
I think that you are being overly dogmatic. All argument passing can be
labeled as call-by-value because, at some level, it must be i.e. my
compiler generates the same code for:
void f(int *) and
void f(int &)
The real question is, without thinking about implementation, what call
type best describes Python method calls? One of my CS textbooks has the
following definition:
"""(CBV) An evaluation strategy where arguments are evaluated
before the function or procedure is entered. Only the values
of the arguments are passed and changes to the arguments
within the called procedure have no effect on the actual
arguments as seen by the caller."""
That certainly does not explain the behavior of Python calls.
Cheers,
Brian
More information about the Python-list
mailing list