python XOR operator

XOR bitwise logical operator '^'
xor return 0 if both values are the same and 1 if different. i.e if exactly one bit is set to 1

working with intergers:

xor es asociativo y conmutativo(igual que la suma)

trick to get the last set bit (rightmost set bit):
rightmostSetBit = val & -val
& returns true if a single bit of all the bits in the two compared values are both set
or maybe just the rightmost one?
100 & 101 == true
100 & 100 == true