Who modified my local variable?

Shane Hathaway shane at hathawaymix.org
Tue Jun 13 22:43:53 MDT 2006


Ross Werner wrote:
> If you can modify a variable inside a function by using the assignment
> operator, then it's pass by reference. If using the assignment operator
> *doesn't* modify the variable, then it's pass by value.

Ah-ha, that clears it up.  I had forgotten that.

I realize now where I got confused: saying "pass by reference" is
entirely different from saying "pass a reference".  The same applies to
the word "value".  So Python passes by value, since the assignment
operator within a function never modifies the caller's binding.

Shane



More information about the PLUG mailing list