Check if a given value is out of certain range

Marko Rauhamaa marko at pacujo.net
Wed Sep 30 14:06:02 EDT 2015


Grant Edwards <invalid at invalid.invalid>:

>   not (0 <= x <= 10)         (I)
> [...]
>    (x < 0) or (x > 10)       (II)
> [...]
> IMO, (I) is _more_ readable than (II)

IMO, they're equally readable (except that you should drop the redundant
parentheses from (II)).


Marko



More information about the Python-list mailing list