Modifying Class Object

Stephen Hansen apt.shansen at gmail.com
Tue Feb 9 05:29:02 CET 2010


On Mon, Feb 8, 2010 at 8:01 PM, Alf P. Steinbach <alfps at start.no> wrote:

> * Stephen Hansen -> Alf P. Steinbach:
>
>>
>> [snip]
>>
>> To say, "pass by value" implies things to people. It describes a sort of
>> world where I'm a function about to do some work, and on my desk I have a
>> series of boxes with names on it. It describes an environment where someone
>> comes over and drops something into each of my boxes. The contents of these
>> boxes are mine alone!
>>
>
> Then, when the imprecision makes people misunderstand, one should not say
> that.
>
> One should then be more precise.
>
> One should say /what/ is passed by value.
>

No.

One should not use the phrase that is fundamentally imprecise.

The phrase "pass by value" means something different then the phrase "pass
by object" aka "pass by sharing". They are in many cases very similar. They
are not the same. Using it is simply wrong. There is really no legitimate
argument you can make otherwise: even in languages where call-by-value IS
the norm, the phrase is imprecise enough to confuse people, as the semantics
of what call-by-value mean to a language vary. But those semantics do NOT
apply to Python.


[snip]
>
>>
>> I know you already know this, but the point is: you're -hurting- other
>> peoples understanding by using terms like this that don't apply to Python's
>> specific nature.
>>
>
> The terms apply very well to Java. And Java has the identical parameter
> passing mechanism for class type objects. Hence, the argument is bogus.
>

Java uses silly terminology; and that it chooses to use silly terminology in
no way impacts the validity of the argument. Java isn't an authority.
Python's been around longer! And the specific behavior here, "call by value
where the value is an object reference" was named "call by sharing" back in
the 1970's by Liskov.

Java isn't call-by-value (for objects) either, even if that phrase is common
in the Java community. C is call-by-value. VB is, I believe, call-by-value
-- though I may be wrong here, as I only sort of blinked at VB a long, long
time ago.

Its distinct. Its different. Its neither call-by-value, nor
call-by-reference. The /value/ of a thing is NOT its identity. Its the
/state/ of that thing.

By your argument, call-by-reference is call-by-value too! Because you're
passing "a value" -- but you're -always- going to pass some piece of data,
otherwise you're not actually passing anything.

The /by value/ vs /by reference/ vs /by sharing/ is not about "is a value
being passed", in all cases, "a value" is. By Value means a copy of the
thing is made. By Reference means you're accessing the callers variable
directly. By Sharing means you're both sharing the same object.

PS: I cannot see any of your postings on Usenet. So I just sort of grabbed
> this from GMane and posted to Usenet. Hopefully you'll see it back at the
> list. :-)


I've heard that before, and have no idea why, nor any real interest in
solving it: I don't want to read cpl via Usenet, and prefer to read it as a
mailing list. Somewhere between Gmail->python.org->python.org's usenet
server->the world, some people don't seem to get my posts. Yet it shows up
on some news servers, not others.

No idea. Nothing I know of can solve it.

--S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100208/450c8342/attachment.html>


More information about the Python-list mailing list