Comment

Comment by hmry

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:
    ...
parent hmry 6 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton