Is it possible to write an inequality with two arguments to be evaluated on one side in Python?

68 views Asked by At

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]

2

There are 2 answers

0
phipsgabler On BEST ANSWER

One option, use max:

a > max(b, c)
1
khelwood On

You could write c < a > b, but it's pretty weird-looking. Probably clearer simply with a > b and a > c.