>>> # this example swaps integers without a temporary variable using XOR >>> a = 2 >>> b = 8 >>> a ^= b >>> b ^= a >>> a ^= b >>> a 8 >>> b 2