Check if a given value is out of certain range

Rustom Mody rustompmody at gmail.com
Sun Oct 4 22:32:55 EDT 2015


On Monday, October 5, 2015 at 7:58:34 AM UTC+5:30, Rustom Mody wrote:
> On Sunday, October 4, 2015 at 7:18:11 PM UTC+5:30, Steven D'Aprano wrote:
> > and some negations may technically be harder to understand, but in a
> > practical sense the difference may be negligible:
> > 
> >     if x == 1: ...
> > 
> >     if x != 1: ...
> > 
> > 
> > I refuse to believe that the second is *significantly* harder to reason
> > about than the first.
> 
> [With hermeneutic/semantic hat firmly on]
> one could make a case that
> "!=" ≠ "not =" ≠ "≠"
> [Back with python hat]
> My preference:
> not 1 <= x <= 10

I take that back:
Unarys binding looser than binaries is "yuck" (in my book)
SO it would have to be
not (1 <= x <= 10)



More information about the Python-list mailing list