Simple newbie question about parameters handling in functions (or am I dump or what?)
Nuff Said
nuffsaid at phreaker.net
Tue Feb 10 05:53:39 EST 2004
On Tue, 10 Feb 2004 10:20:11 +0000, Niki Iv wrote:
> I am totaly new to Python, although I have quite strong developer
> background. Indeed I am evaluating Python to integrate it (Jython) in
> my Java apps...
> Well this is my first Python day. I am tampering with functions. I
> read that parameters are passed by-value rather than by-reference. So
> function can change wathever parameters reffers to. My troube (well my
> presonal not understanding comes from this)
Observe that there are mutable and immutable objects in Python and that
the *value* in Python's 'call by value' is always an *object reference*.
The following excerpt from the Python tutorial describes this:
The actual parameters (arguments) to a function call are
introduced in the local symbol table of the called function
when it is called; thus, arguments are passed using call by
value (where the value is always an object reference, not the
value of the object).
(Actually, 'call by object reference' would be a better description,
since if a mutable object is passed, the caller will see any changes
the callee makes to it (items inserted into a list).)
[http://www.python.org/doc/2.3.3/tut/node6.html]
HTH / Nuff
More information about the Python-list
mailing list