no pass-values calling?

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Wed Jan 16 06:33:47 EST 2008


On Wed, 16 Jan 2008 17:46:39 +1100, Ben Finney wrote:

> Christian Heimes <lists at cheimes.de> writes:
> 
>> Dennis Lee Bieber wrote:
>> > 	Since all "variable" names in Python are references to objects,
>> > anything accessed using a name is accessed by reference.
>> 
>> Anybody using the terms variable, reference or call-by-value is most
>> likely explaining Python the wrong way.
> 
> The term "reference" is fine, since that's exactly how it works. One
> gets at an object via some reference, be it a name or some access into a
> container object. When an object has no more references to itself, it
> becomes a candidate for garbage collection. And so on.

The term "reference" *by itself* is fine, so long as there is no 
possibility of confusion with the very common concept of "call by 
reference" (or "pass by reference"). 

But since the Original Poster himself raised the question of whether 
Python is call by reference or call by value, that should be a great big 
warning flag to avoid the term "reference" until he's reset his brain. 
Python is not C, and if you talk about Python using C terminology without 
making it absolutely crystal clear that the semantics of that terminology 
is different in Python, then you'll just reinforce the O.P.'s 
misunderstandings.

Python might have "references" in the generic sense, but in the specific 
sense that it is understood by most people with C/Pascal/Java/Perl 
experience, Python does not.



-- 
Steven



More information about the Python-list mailing list