Comparison operators in #Python can be chained together, but using them that way could be controversial. I wrote this this other day:
@nedbat I'm a big fan of parentheses for clarity, even when they're technically not needed.
@ehmatthes But parentheses would break the comparison here.
@nedbat I like how `...` is actually a usable value in Python, so the code as you wrote it is literally runnable as well.
@nedbat I like chained comparisons for chains that detect ordered values like: value_a < value_b < value_c. I find other uses to be lazy and confusing.
@nedbat I am probably in the minority here, but I find the operator chaining perfectly readable (maybe I am just used to mathematics papers).
@nedbat, for readability, you should write it as:
if (n_passed == (n_tests) != 0):
...
@nedbat after reading ellipses in online gaming this reads as the most passive aggressive code I've ever read. Like python is just waiting for me to figure out what the variables are gonna be.
@nedbat TIL. :(