Boolean Headache
today i had to do some refactoring and came across this piece of python code (using requests)
400 >= response.status_code
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"
i realized switching the statement the other way around made my headache go away;
response.status_code <= 400
now its clear to me, myself and I: "status_code needs to be less than or equal to 400"
i realized i had suffered a brief encounter with boolean headache inducing syntax
anybody felt the same anytime?
5 comments
[ 4.2 ms ] story [ 26.1 ms ] thread