Joseph Garvin wrote:
> ncf wrote:
>
> >Hello all, I was wondering if there was any way to pass arguments
> >(integer and such) by reference (address of), rather than by value.
> >
> >Many thanks in advance.
> >
>
> All mutable types in python are passed by reference automatically.

More accurately:

(1) All function arguments are passed by value, but
(2) All "values" are pointers.

Statement (2) also explains why

>>> a = [1, 2, 4]
>>> b = a
>>> b[1] = 0
>>> print a
[1, 0, 4]

behaves the way it does.

And there's no difference between mutable and immutable types.  It's
just that with immutable types, it doesn't matter how they're passed.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to