Modifying Class Object
Alf P. Steinbach
alfps at start.no
Sun Feb 14 04:44:26 CET 2010
> In article <hl6ilk$f7h$1 at news.eternal-september.org>,
> Alf P. Steinbach <alfps at start.no> wrote:
>> My original statement, with reference to the Java language spec,
>> didn't say much more about the language than that it has assignable
> Assuming this is what you're referring to:
> Python passes pointers by value, just as e.g. Java does.
> Then you are simply, completely, totally, and absolutely wrong. Period.
> Regardless of how CPython manages its state internally, Python as a
> programming language does not have pointers.
The next paragraph was about the meaning of "pointer" in that first paragraph,
referring to the Java language specification for the particular meaning here,
namely a reference. Note: I did not refer to CPython, C, Pascal or whatever (but
you mention CPython) for a meaning of "pointer". Instead I referred to the Java
language specification for that meaning, where it's pretty clear: reference.
So if you don't like the terminology, you can rephrase with perhaps more
Python uses pass by sharing.
References to objects are copied, the objects themselves are not copied.
See <url: http://en.wikipedia.org/wiki/Evaluation_strategy#Call_by_sharing>
If you go to that URL, which isn't auhoritative but good enough, you find that
"identical semantics in other languages such as Java and Visual Basic"
Hence, your point is only a matter of terminology. The semantics /can/ be
described using the term "pointer" (or for that matter the term "thingamajic"),
when that term is suitably defined, and it /is/ described using that word for
some languages. The language doesn't matter for the concept of pass by sharing.
Hence, the terminological issue doesn't invalidate the description, as long as
the terminology is clearly defined, as I did with ref to the Java lang spec.
As you can see proper terminology reduces the size of explanation considerably,
but as I see it that's not a big deal as long as the description is still
/reasonably/ short. It does become a concern when the description runs to many
pages of text. A simple thing should IMHO be simply described.
But I think, as I've already stated several times up-thread, that "pointer" is a
term best avoided for explanations within the Python community, even with a
reference to a particular definition/usage, making the more verbose version in
terms of "references" preferable for Python -- don't you agree?
More information about the Python-list