[Python-Dev] Lukewarm about range literals
Greg Ewing
greg@cosc.canterbury.ac.nz
Wed, 30 Aug 2000 14:11:41 +1200 (NZST)
> I doubt there would be much
> problem adding ".." as a token either.
If we're going to use any sort of ellipsis syntax here, I
think it would be highly preferable to use the ellipsis
token we've already got. I can't see any justification for
having two different ellipsis-like tokens in the language,
when there would be no ambiguity in using one for both
purposes.
> What we really want I think is something that evokes the following in the
> mind of the reader
>
> for i from START to END incrementing by STEP:
Am I right in thinking that the main motivation here is
to clean up the "for i in range(len(a))" idiom? If so,
what's wrong with a built-in:
def indices(a):
return range(len(a))
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 +--------------------------------------+