No swap function in Python?

Pierre Barn pbarn at altern.org
Wed May 30 11:35:41 EDT 2001


in article 3B150A65.5D4986FC at europem01.nt.com, Bolton, Gawain
[ADC:4808:EXCH] at boltong at europem01.nt.com wrote on 30/05/01 16:57:

> Which made me think that a swap could be done like this:
> 
> (a,b) = (b,a)

You can do a, b = b, a
As you discovered.

> is this an efficient
> way of doing a swap?

It is
-- 
Regards,
Francois Granger
fgranger at teleprosoft.com - <http://www.teleprosoft.com>





More information about the Python-list mailing list