today i had to do some refactoring and came across this piece of python code (using requests)<p>400 >= response.status_code<p>i first read it as "status of response has to be higher than or equal to 400" but then i read it again a few times (read 10+) with increasing levels of headache and realized i read it all wrong, it was "status_code needs to be less than or equal to 400"<p>i realized switching the statement the other way around made my headache go away;<p>response.status_code <= 400<p>now its clear to me, myself and I: "status_code needs to be less than or equal to 400"<p>i realized i had suffered a brief encounter with boolean headache inducing syntax<p>anybody felt the same anytime?
Yes absolutely. I tend to put my comparisons in order from least to highest always these days, so it’s “value < max” and “min < value”. Eases up on the headwork
A Yoda condition you have meet. <a href="https://en.wikipedia.org/wiki/Yoda_conditions" rel="nofollow">https://en.wikipedia.org/wiki/Yoda_conditions</a> The "Advantage" section you must read.