call-by-reference (was Re: Any other Python flaws?)
m.faassen at vet.uu.nl
Fri Jun 15 21:19:03 CEST 2001
jcm <grumble at usa.net> wrote:
> Martijn Faassen <m.faassen at vet.uu.nl> wrote:
>> I agree that nobody agrees on whatever 'call-by-reference' means, or what
>> 'call-by-value' means. I mean, I'm here confused why you'd say C++ doesn't
>> support call-by-value while Python apparently does. :)
> In my experience, there's good agreement about what call-by-reference
> means just about everywhere but in newsgroups. Python supports only
> call-by-value -- you can't change the value of a variable in your
> caller's scope (globals aside).
Um, I wouldn't say it that way. Python supports changing the value a
name references just fine:
l = [1, 2, 3]
Though of course the value of immutable values can't be changed.
Python doesn't support the changing of the *reference* of the name in
the caller's scope (awful hacks aside).
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?
More information about the Python-list