[Tutor] Variable Swap
kent37 at tds.net
Mon Jan 29 13:51:14 CET 2007
Steve Nelson wrote:
> I understand the use of xor to do a variable swap without a temporary variable:
> However, why do I see this?
Because 2 ^ 3 == 1, right? Are you sure you understand what xor does? It
is a bitwise exclusive or:
By the way in Python you can write
x, y = y, x
as a readable alternative.
More information about the Tutor