passing by refference
Aahz
aahz at pythoncraft.com
Tue May 13 17:48:36 EDT 2003
In article <87vfwewocj.fsf at charter.net>,
Doug Quale <quale1 at charter.net> wrote:
>aahz at pythoncraft.com (Aahz) writes:
>>
>> Note that I'm using "binding" instead of "reference"; like the mistaken
>> use of "call-by-value", "reference" has semantics that make sense in
>> other languages, but not in Python.
>
>Actually call-by-value makes sense in Python and its use here is not
>mistaken. Call-by-value is the correct description of the semantics
>of function calls in Python. There's nothing mystical or even in the
>slightest bit unusual with the way that Python passes arguments.
>Claiming that Python argument passing is not call-by-value is simply
>wrong and leads to needless confusion.
Call-by-value is normally used when the values are explicitly passed.
In Python, the value that's being passed is implicit; you can't access
it directly. Period, exclamation point. The only thing you can do with
that value is assign it to a[nother] target or make method calls on the
object at the other end of the binding.
So while you're technically correct, I'll stick by my contention that
"call-by-value" causes more confusion than it saves.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"In many ways, it's a dull language, borrowing solid old concepts from
many other languages & styles: boring syntax, unsurprising semantics,
few automatic coercions, etc etc. But that's one of the things I like
about it." --Tim Peters on Python, 16 Sep 93
More information about the Python-list
mailing list