News for hackers. Stuff that matters.
Re:Why does `True == False is False` evaluate to False in Py... by hmry on Saturday May 02, 2020 @06:48AM (#23050941)
But in your proposed solution b would be evaluated twice. So you would have to add a new line, think of a new variable name, and so on.

  if lower < x.calculate_weight() < upper:
    ...
Suddenly turns into

  x_weight = x.calculate_weight()
  if lower < x_weight and x_weight < upper:
    ...
Re:Why does `True == False is False` evaluate to False in Py... by nitroll on Saturday May 02, 2020 @01:39PM (#23053456)
And is that so bad? So often i did stuff like that, then finding I actually need the result of x.calculate_weight() inside the condition, or to debug it or log it in some way. Then it has to be extracted anyway.