On May 10, 5:47 pm, Adam Atlas <[EMAIL PROTECTED]> wrote: > On May 10, 5:43 pm, lazy <[EMAIL PROTECTED]> wrote: > > > I want to pass a string by reference. > > Don't worry, all function parameters in Python are passed by reference.
Actually, just to clarify a little bit if you're understanding "pass by reference" in the sense used in PHP, sort of C, etc.: In Python, you have objects and names. When I say all function parameters are passed by reference, I don't mean you're actually passing a reference to the *variable*. (Like in PHP where you pass a variable like &$foo and the function can change that variable's value in the caller's scope.) You can never pass a reference to a variable in Python. But on the other hand, passing a parameter never causes the value to be copied. Basically, you have a variable that's a reference to an object somewhere in memory, and passing it to a function gives that function's scope a new pointer to that same location in memory. So if the function you pass it to assigns some other value to the variable, that's all it's doing: reassigning a local name to point to somewhere else in memory. -- http://mail.python.org/mailman/listinfo/python-list