Is it possible to write an inequality with two arguments to be evaluated on one side in Python?
Question:
Is there a cleaner way of writing the following:
(a > b) and (a > c)
The following doesn’t work, but this might illustrate the kind of thing I’m looking for:
a > [b, c]
Answers:
One option, use max
:
a > max(b, c)
You could write c < a > b
, but it’s pretty weird-looking. Probably clearer simply with a > b and a > c
.
Is there a cleaner way of writing the following:
(a > b) and (a > c)
The following doesn’t work, but this might illustrate the kind of thing I’m looking for:
a > [b, c]
One option, use max
:
a > max(b, c)
You could write c < a > b
, but it’s pretty weird-looking. Probably clearer simply with a > b and a > c
.