Finding the instance reference of an object

Steven D'Aprano steven at REMOVE.THIS.cybersource.com.au
Tue Nov 4 22:24:00 EST 2008


On Tue, 04 Nov 2008 18:00:35 -0800, George Sakkis wrote:

> On Nov 4, 6:02 pm, Joe Strout <j... at strout.net> wrote:
> 
>> I know you really want Python to be unique and special -- and it is, in
>> many ways, but this isn't one of them.  Python is an OOP language whose
>> variables contain references to objects, and where such references are
>> passed (by value) to methods, just likeJava, and like the default
>> parameter mode in VB.NET, REALbasic, and C++ (though those languages
>> also offer a by-reference mode that Python andJavado not).
> 
> To Steve's defense, he doesn't claim that Python is special; in one
> reply he also disputed the claim that even Java is call-by-value.


Python is as special as CLU, Lisp, Emerald, Iota and others.


"As in Java, the calling semantics are call-by-sharing: the formal 
argument variable and the actual argument share the same value, at least 
until the argument variable is assigned to. Assignments to the argument 
variable do not affect the value passed; however, if the value passed was 
an array, assignments to elements of that array will be visible from the 
calling context as well, since it shares the same array object."

http://www.cs.cornell.edu/courses/cs412/2001sp/iota/iota.html


> Of
> course most Java programmers would have a hard time taking this claim
> seriously, 

That's their problem, not mine. If the Java community wishes to redefine 
"value" to mean an arbitrary, implementation-dependent reference instead 
of the actual value of the variable, that's their loss.


-- 
Steven



More information about the Python-list mailing list