swap function?

Andy Smith ams70 at cam.ac.uk
Wed Nov 15 19:44:15 EST 2000


Bob van der Poel <bvdpoel at uniserve.com> writes:

> I'm sure I'm just being very dumb today...but I was looking for a swap
> function and can't seem to find anything. I really don't need to do:
> 
> 	temp=a
> 	b=a
> 	a=temp
> 
> everytime I need this do I????

Try a,b = b,a.

    Andy
-- 
Andy Smith                                             ams70 at cam.ac.uk
St John's College, Cambridge, CB2 1TP, UK               (07989) 453208



More information about the Python-list mailing list