On 2014-02-17, Oscar Benjamin <oscar.j.benja...@gmail.com> wrote: > On 17 February 2014 16:17, Gabriele Brambilla ><gb.gabrielebrambi...@gmail.com> wrote: >> Doesn't exist a way in Python to do like in C >> >> for i=0, i<100, i=i+10 >> >> ? without creating a list of index? > > You haven't said which Python version you're using. In Python 2 > the range function returns a list but the xrange function > returns an iterator. In Python 3 the range function returns an > iterator.
In Python 3 it range returns a range object, which is a sequence type. >>> x = range(100) >>> x range(0, 100) You can use slice notation on range objects. >>> x[::10] range(0, 100, 10) So we've got *that* going for us. -- Neil Cerutti _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor