[Python-Dev] Lukewarm about range literals (original) (raw)

Greg Ewing greg@cosc.canterbury.ac.nz
Tue, 29 Aug 2000 17:17:38 +1200 (NZST)


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

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

That looks quite nice to me!

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

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

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

and be vastly clearer?

Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+