PEP 276 Simple Iterator for ints
David Eppstein
eppstein at ics.uci.edu
Thu Nov 15 17:23:45 EST 2001
In article <3BF43EA3.42A5A4B6 at ccvcorp.com>,
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)?
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.
--
David Eppstein UC Irvine Dept. of Information & Computer Science
eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/
More information about the Python-list
mailing list