Problem with assigning variables of type List

Greg Ewing see_reply_address at something.invalid
Wed Aug 21 23:57:29 EDT 2002


Fredrik Lundh wrote:

> 
> perhaps if you're using your own, very precise and extremely narrow
> definitions of words like "value", "argument", "change", "procedure" etc.


They're not *his* definitions, they're *the* definitions
used in defining the terms call-by-value and call-by-reference.
Some of them are unfortunately different from the conventional
use of the same words in relation to Python. This means that,
if you want to meaningfully apply the terms call-by-value and
call-by-reference to Python, you have to be prepared to
translate.

The biggest offender is the word "reference", which has
equally precise but different meanings in the two areas.
We should be using two different words for them, let's
say cm-reference ("cm" for "calling mechanism") and
py-reference. Similarly, we have cm-value and py-value.

Now we have the following translation table:

     Calling mechanism        Python
     --------------------------------------
     cm-reference             no equivalent
     cm-value                 py-reference

With this in mind, it is clear that Python's calling
mechanism is call-by-cm-value, or more conventionally,
call-by-value. You could also call it call-by-py-reference,
but abbreviating that to call-by-reference only confuses
anyone who thinks you mean call-by-cm-reference.

It would also help if we became less afraid of using
the term "variable" in relation to Python. There's no
trouble defining it in a way that makes perfectly good
sense in Python and is also compatible with the terminology
used in cm-land. But for some reason some people want to
insist that "there are no variables in Python, only
names" or "only bindings" or some other nonsense.

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg




More information about the Python-list mailing list