inclusive-lower-bound, exclusive-upper-bound (was Re: Range Operation pre-PEP)

Aahz Maruch aahz at panix.com
Thu May 10 23:45:08 EDT 2001


In article <3AFB0DB9.BDAE54A5 at one.net.au>,
Andrew Maizels  <andrew at one.net.au> wrote:
>
>I can see where consistency is important, but why does Python do the
>inclusive-lower-bound, exclusive-upper-bound thing?

Because it makes loops more likely to work.  E.g.:


l = [1,4,9,16]
for i in range(len(l)):
    print l[i]
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Androgynous poly kinky vanilla queer het Pythonista   http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

"Everyone is entitled to an *informed* opinion."  --Harlan Ellison



More information about the Python-list mailing list