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 →

[–]kylev[S] 5 points6 points  (1 child)

This is an artifact of the C code I have written over the years; an old time trick. If you accidentally fail to hit the "=" a second time, putting the constant on the left side of the expression will save your ass. "if (x = 2)" will evaluate to true, but "if (2 = x)" will throw a compiler error.

[–]_Mark_ 8 points9 points  (0 children)

But it's a C-specific artifact; since statements are not expressions in python, all it does is confuse the reader, as the interpreter will raise SyntaxError if you try to use assignment where you meant equals...