Beginner question - How to effectively pass a large list

Ben Finney bignose-hates-spam at and-benfinney-does-too.id.au
Mon Dec 15 18:34:39 EST 2003


On Mon, 15 Dec 2003 15:14:48 +0800, J.R. wrote:
> The python can only support passing value in function call (right?)

Wrong.  Function parameters in Python are always passed by reference,
not by value.  The local function parameter gets a binding to the same
object that was passed, so there are not two copies of the object in
memory.

Of course, because of the way that Python treats assignment, you can
then change that local parameter within the function and it will re-bind
to the new value, without altering the original value passed.

-- 
 \     "I went to a fancy French restaurant called 'Déjà Vu'. The head |
  `\               waiter said, 'Don't I know you?'"  -- Steven Wright |
_o__)                                                                  |
Ben Finney <http://bignose.squidly.org/>




More information about the Python-list mailing list