I'm surprised Python's = did not have this already, like C++ does...,(reply>), ​@odomobo if preventing a mistake is of utmost importance, then refactoring the conditional expression into a function that takes x and y by const reference (or pointer in C) is always possible.,(reply>), @NoHomeLike 192.168.8.1 That's assuming that x can be marked const in that scenario,(reply>), in C/C++ you can avoid this issue entirely by marking x or both as const<br><br>const int x = 1;<br>int y = 2;<br>if(x = y) { // error, assignment to a const variable<br>    std::cout &lt;&lt; "You're Dumb" &lt;&lt; std::endl;<br>},(reply>), @DoraTheExploder That line isn't where your error will occur though,(reply>), @odomobo It sets x to 2 and returns 2, if you want comparison use ==. It's really not that hard.