Check if a given value is out of certain range

Marko Rauhamaa marko at pacujo.net
Thu Oct 1 15:59:20 EDT 2015


John Gordon <gordon at panix.com>:

> I wasn't commenting directly to the "ask not..." quote; I was
> referring upthread to the choice between
>
>     not 0 <= x <= 10
>
> and
>
>     x < 0 or x > 10
>
> Both are of course understandable, but in my opinion, the latter one
> takes slightly less effort to grok.

Wouldn't

   x < 0 or 10 < x

be even more visual?


Marko



More information about the Python-list mailing list