[Python-3000] optimizing [x]range

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Jul 30 02:29:14 CEST 2007


skip at pobox.com wrote:

> You can't spell
> 
>     a <= x <= b
> 
> or
> 
>     a < x < b
> 
> without remembering to add or subtract 1 from the appropriate endpoint

I think the use cases for this are where you're trying to
express a range-like condition, i.e 'a <= x < b'. Then you
have to make sure you get the right relations in the right
places, which is the same kind of burden as remembering to
add or subtract 1 in the right places.

--
Greg


More information about the Python-3000 mailing list