Function to take the minimum of 3 numbers

Matt Wheeler funkyhat at gmail.com
Sun Oct 9 20:38:58 EDT 2016


On Mon, 10 Oct 2016, 00:56 Ian Kelly, <ian.g.kelly at gmail.com> wrote:

> On Oct 9, 2016 2:57 PM, <breamoreboy at gmail.com> wrote:
> The Pythonic way
>
> if b >= a <= c:
>     ...
>
>
> Better:
>
> if a <= b <= c:
>     ...
>

That's not equivalent. Consider `a, b, c = 1, 7, 4`


> Using consistent operators is not required but is easier to read and less
> confusing.
>

Unfortunately in this case it's also less correct

> --

--
Matt Wheeler
http://funkyh.at



More information about the Python-list mailing list