Pass by reference ?

Bjorn Pettersen bjorn at roguewave.com
Mon Apr 3 19:26:33 CEST 2000


Jacek Generowicz wrote:
> 
> Hi,
> 
> I'm just trying to familiarize myself with Python.
> In Magnus Lie Hatland's Instant Python, he
> mentions that `all parameters in Python are passed
> by reference'.

The technically correct (although much less known) term is
pass-by-object-reference.  All this means is that you can change an
argument to a function by calling methods on the object, but you can't
change the identity of the object (ie. simply calling a function can't
change any name-bindings in your current scope).

Std disclaimer that anything can happen if you are willing to mess with
frame objects apply...

-- bjorn




More information about the Python-list mailing list