Finding the instance reference of an object

Douglas Alan doug at alum.mit.edu
Wed Oct 29 01:25:03 EDT 2008


Joe Strout <joe at strout.net> writes:

> There are only the two cases, which Greg quite succinctly and
> accurately described above.  One is by value, the other is by
> reference.  Python quite clearly uses by value.

You make a grave error in asserting that there are only two cases.
Algol, for instance, used call-by-name, which is neither call-by-value
or call-by-reference.  There are a number of other evaluation
strategies.  For a primer on the subject see the following Wikipedia
page:

   http://en.wikipedia.org/wiki/Evaluation_strategy

CLU used the termed "call-by-sharing" for the evaluation strategy
shared by Python, Lisp, CLU, Java, Ruby, and JavaScript, etc.

It should be noted that the Wikipedia page does not document
"call-by-sharing", in specific and refers to Python's strategy as a
type of call-by-value.  It also notes that call-by-value is not a
single evaluation strategy, but rather a family of evaluation
strategies, and that the version of the strategy used by Java (and
hence Python) shares features with call-by-reference strategies.

Consequently, many people prefer to use a different name from
"call-by-value" for Python/Java/Lisp's strategy in order to avoid
confusion.  In any case, no one can disagree with the fact that the
evaluation strategy used by Python et. al., differs significantly from
the call-by-value evaluation strategy used by C and the like, whatever
you wish to call it.

|>oug



More information about the Python-list mailing list