[Tutor] What is the augmented assignment operator "^="
Dick Moores
rdm at rcblue.com
Mon Feb 19 10:45:09 CET 2007
The docs list it at <http://docs.python.org/ref/augassign.html>, and
send you to <http://docs.python.org/ref/primaries.html#primaries>,
which seems a dead end.
I've tried "^=" out a bit:
>>> n = 5
>>> n ^= 8
>>> n
13
>>> n ^= 8
>>> n
5
>>> n ^= 8
>>> n
13
>>> n ^= 8
>>> n
5
and get that strange alternating behavior. Can someone explain? And
while at it, please also explain "&=" and "|=".
Thanks,
Dick Moores
More information about the Tutor
mailing list