I ran across the caret operator in python today and trying it out, I got the following output:
>>> 8^3
11
>>> 8^4
12
>>> 8^1
9
>>> 8^0
8
>>> 7^1
6
>>> 7^2
5
>>> 7^7
0
>>> 7^8
15
>>> 9^1
8
>>> 16^1
17
>>> 15^1
14
>>>
It seems to be based on 8, so I'm guessing some sort of byte operation? I can't seem to find much about this searching sites other than it behaves oddly for floats, does anybody have a link to what this operator does or can you explain it here?
help('^')
– Backache**
, the exponentiation operator. – Synnhelp('^')
does nothing in my Python 2.6.1 (apple build). @S.Lott: do you mean this (docs.python.org/reference/…) when you're saying "completely covered"?. Seems a bit sparse for someone unfamiliar with the concept... – Samara^
does.help('^')
in the interactive interpretter should pull up the help explaining the arithmetic operators, which would have provided only the name "bitwise XOR", which would have been enough information to go on. – Synn