Pass by reference ?

Jacek Generowicz jmg at ecs.soton.ac.uk
Wed Apr 5 04:27:04 EDT 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'.

[snip]

Thank you for your answers.

I would welcome a critique of the following summary:

Python variables are implemented as references to
values.

Assignment (potentially) alters the reference rather
than the value to which it refers.

Objects can be classified into two sets: mutalble and
immutable.

Mutation of a mautable passed into a function will be
reflected in the mutation of the object which was
passed into the function; achieving similar behaviour
for immutables is more complicated.

Jacek





More information about the Python-list mailing list