Hello,

I understand the use of xor to do a variable swap without a temporary variable:

>>> x=2
>>> y=3
>>> y=x^y
>>> x=x^y
>>> y=x^y
>>> x
3
>>> y
2


However, why do I see this?

>>> y=x^y
>>> y
1

S.
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to