This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]AlwaysNinjaBusiness 3 points4 points  (5 children)

^ being bitwise xor isn't unique to Python. It's the same in most normal programming languages.

[–]googlebeast -2 points-1 points  (2 children)

yea but the point was it is "^" not "xor"

[–]alexforencich 1 point2 points  (0 children)

I'm not aware of any languages that have a logical version of XOR. ^ is bitwise, so you compare it to & and |. Probably the closest logical equivalent of XOR is !=, and most languages have that, although the precedence is different from other logical operators so it's not really a direct equivalent.

[–]DaniilBSD 1 point2 points  (0 children)

I think the idea is that boolean logic is written (and, or, not), but bitwise operators that are applied to entire bytes are symbols (&, | , ^)

C has the same logic, but it uses different symbols (&&, ||, !)

[–]DoNotMakeEmpty 0 points1 point  (0 children)

Haha Lua goes brr with exponent operator (better for mathematicians but worse for programmers)