On Oct 29, 9:13 pm, Joe Strout <[EMAIL PROTECTED]> wrote: > On Oct 29, 2008, at 4:52 PM, Fuzzyman wrote: > > > You're pretty straightforwardly wrong. In Python the 'value' of a > > variable is not the reference itself. > > That's the misconception that is leading some folks around here into > tangled nots of twisty mislogic, ultimately causing them to make up > new terms for what every other modern language is perfectly happy > calling Call-By-Value.
Doesn't this logic also apply to Call By Reference? Isn't that term redundant too? (see my 3 C++ examples above). If not, why not? Are you saying that C++ is capable of using the Call By Reference idiom, but C is not, because C does not have a reference designation for formal function parameters? "Call By Object Reference" is an idiom, just like Call By Reference. It is not a physical description of what is going on internally at the register/stack level (which is always just shuffling values around - or flipping bits, as Steven points out), it is a higher level concept that helps people understand the *intention* (not necessarily the implementation) of the mechanism. You cannot look a C++ programmer straight in the eye and say that "Python uses Call By Value, Period", without also informing them that "Python variables can ONLY EVER hold object references - that is the only "value" they can ever hold". Then the C++ programmer will go "Oh, yea, that makes sense". Instead of having to say all of that, we just give it a new name. Instead of "Call By Value, Where Every Single Value Is Only Ever A Reference To An Object Which Contains The Actual Value That Programmers Usually Refer To", we just say "Call By Object Reference". > ... > 2. Because everything in Python is an object, you're not forced to > think clearly (and more generally) about references as values I think we've shown that we are all in fact thinking clearly about it, and we all (you included, of course!) understand what is going on. It's just a matter of what words we choose to describe it. Using your definition of value, though, I believe that if you want to throw out Call By Object Reference, you also have to throw out Call By Reference. See my 3 C++ examples above. And just for fun I did look at the assembler output, and, indeed, the output for examples 1 and 3 is absolutely identical. They are the same thing, as far as the CPU is concerned. Would you give them different names? dale -- http://mail.python.org/mailman/listinfo/python-list