PEP 276 Simple Iterator for ints
wtanksle at dolphin.openprojects.net
Fri Nov 16 01:10:25 CET 2001
On Thu, 15 Nov 2001 14:23:45 -0800, David Eppstein wrote:
> Jeff Shannon <jeff at ccvcorp.com> wrote:
>> > >>> for i in int[2:10:2]: print i,
>> > 2 4 6 8
>> This doesn't look too bad to me. I'd go for it.
>Why is int[2:10:2] an improvement over range(2,10,2)?
Because it names the type over which ranges are selected, gives the remote
possibility of being useful for other types, and because it allows the
possibility of infinite ranges.
>They have the same number of words and the same argument values with the
>same amount of punctuation, the only difference to me is that int[2:10:2]
>is in a much less familiar syntax.
Of course, you're right here. I see this as a problem with all the
suggestions being made here -- the "problem" being solved is so tiny that
the improvements suggested just don't matter.
>David Eppstein UC Irvine Dept. of Information & Computer Science
-William "Billy" Tanksley
More information about the Python-list