[Python-Dev] Lukewarm about range literals

Barry A. Warsaw bwarsaw@beopen.com
Tue, 29 Aug 2000 01:30:31 -0400 (EDT)


>>>>> "GE" == Greg Ewing <greg@cosc.canterbury.ac.nz> writes:

    GE> Ka-Ping Yee <ping@lfw.org>:

    >> for i in 1 .. 10: print i*i

    GE> That looks quite nice to me!

Indeed.

    >> for i in 0 ..! len(a): a[i] += 1

    GE> And that looks quite ugly. Couldn't it just as well be

    |     for i in 0 .. len(a)-1:
    |         a[i] += 1

    GE> and be vastly clearer?

I agree.  While I read 1 ..! 10 as "from one to not 10" that doesn't
exactly tell me what the sequence /does/ run to. ;)

-Barry