experts disagree on "call-by-reference"

Greg Ewing see at my.signature
Wed Aug 2 22:37:32 EDT 2000


Martijn Faassen wrote:
> 
> I think the confusion arises in the 'call/pass by' part of the expression
> 'call/pass by reference'.

I think the confusion arises when people say things like
"python uses pass-by-reference" without making it clear
*what* is being passed. To accurately describe Python
parameter passing in Algol terms, you can't just say
"x is passed by reference", because that implies that
a reference the *variable* x is being passed.

Instead, you have to say something like "the object
referred to by x is passed by reference". Or alternatively,
"x is passed by value, and that value is a reference
to an object". Just calling it "pass by reference" or
"pass by value" are both half true and half false.

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list