"always passes by reference"

Greg Weeks weeks at golden.dtc.hp.com
Sat Jul 29 20:41:38 EDT 2000


Ulrich Schreiner (ulrich.schreiner at innuendo.de) wrote:
: it is all so easy, so why this big discussion?

: you have ONE and exactly ONE object identity, but you can have multiple
: references to this identity. in your program you always work with
: references.

So you phase it.  I would never talk that way myself, and if someone asked
me to describe what was going on, I would use quite different words, eg:
Each object is the address of a region of memory -- an address that can be
written to multiple locations.  You prefer to think of the object as a
region of memory [I think], and you define a writing of that memory's
address to be a "reference".  I prefer to think of the object as an
address, and I don't give any special name to a writing of that address.

There is no right or wrong here, but there is also no single correct
description of what is going on.  Some say Python is call-by-reference,
some say Python is call-by-value.  Everyone is correct.


Greg


PS: My motivation for my particular phasing is that I like to view all data
in the computer as patterns of 0s and 1s.  (I find this tidy and easy to
remember.)  An address is a pattern of 0s and 1s.  A block of memory is
not.  So, for me, a datum can be an address, but not a block of memory.



More information about the Python-list mailing list