* sturlamolden, on 12.07.2010 16:59:
On 12 Jul, 07:51, "Alf P. Steinbach /Usenet"<alf.p.steinbach
+use...@gmail.com> wrote:
We're talking about defining a 'swap' routine that works on variables.
I did not miss the point. One cannot make a swap function that rebinds
its arguments in the calling stack frame. But a swap function can swap
values, given that the type is not immutable:
def swap(a,b):
a[0],b[0] = b[0],a[0]
a,b = [1],[2]
swap(a,b)
print a,b
[2] [1]
OK, that's missing the point.
I thought you were joking.
Cheers & hth.,
- Alf
--
blog at <url: http://alfps.wordpress.com>
--
http://mail.python.org/mailman/listinfo/python-list