Check if a given value is out of certain range

Ian Kelly ian.g.kelly at
Wed Sep 30 07:54:03 CEST 2015

On Tue, Sep 29, 2015 at 9:14 PM, Steven D'Aprano <steve at> wrote:
> On Wed, 30 Sep 2015 01:08 pm, Random832 wrote:
>> Steven D'Aprano <steve at> writes:
>>> It's not fine. In Python 2,
>>> Testing a numeric value within a certain range of values should be
>>> constant time and constant memory. It should be *fast*. Using range in
>>> Python 2 is none of those things.
>> I wasn't aware we were discussing Python 2.
> Was there something in the OP's question that suggested to you that we were
> only discussing Python 3?
> Python 2.7 is still the main version used by most people.

As far as I'm concerned, Python is Python 3. I'm aware that the check
is inefficient in Python 2, but I tire of constantly pointing out
Python 2 as the exception to everything.

More information about the Python-list mailing list