Check if a given value is out of certain range

Ian Kelly ian.g.kelly at gmail.com
Thu Oct 1 18:01:17 EDT 2015


On Thu, Oct 1, 2015 at 3:45 PM, John Gordon <gordon at panix.com> wrote:
> In <87r3le1ht3.fsf at elektro.pacujo.net> Marko Rauhamaa <marko at pacujo.net> writes:
>
>> > 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?
>
> I don't know what you mean by "more visual".

Visually, it places the x outside the range suggested by 0 and 10,
similarly to how 0 <= x <= 10 places the x inside.



More information about the Python-list mailing list