Beginner question - How to effectively pass a large list
alan.gauld at btinternet.com
Wed Dec 17 19:46:10 CET 2003
On Tue, 16 Dec 2003 16:21:00 +0800, "J.R." <j.r.gao at motorola.com>
> Actually, the python is passing the identity (i.e. memory address) of each
> parameter, and it will bind to a local name within the function.
This is one case where understanding something of the insides of
Python helps. Basically Python variables are dictionary entries.
The variable values are the the dictionary values associated with
the variable names which are the dictionary keys.
Thus when you pass an argument to a function you are passing a
dictionary key. When the function uses the argument it looks up
the dictionary and uses the value found there.
This applies to all sorts of things in Python including modules -
a local dictionary associated with the module, and classes -
another dictionary. Dictionaries are fundamental to how Python
works and memory addresses per se play no part in the procedings.
Author of the Learn to Program website
More information about the Python-list