Driver python expression doesn't work as intended (doesn't calculate if else properly)
I wouldn't trust the value in a quaternion to exactly equal a whole number.
There are decimal numbers that a base two floating point number can't represent, for the same reason that you can't represent 1/3 exactly in base ten. While -1 isn't one of those numbers, it's conceivable and probably to be expected that some minute inaccuracy would have been introduced in producing the number that's used for that driver channel.
Try this:
0 if abs(-1-var) &lt; 0.001 else 1
or
0 if var &lt; -0.999 else