call-by-reference (was Re: Any other Python flaws?)
grumble at usa.net
Fri Jun 15 23:02:11 CEST 2001
Martijn Faassen <m.faassen at vet.uu.nl> wrote:
> jcm <grumble at usa.net> wrote:
>> 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:
> def foo(a):
> l = [1, 2, 3]
Note I said you can't change the value of a _variable_ in your
caller's scope. Changing the state of an object isn't the same.
More information about the Python-list