
Hi Just wondering, would anyone think of it as a good idea if the enumerate() builtin could accept a "start" argument? I've run across a few cases where this would have been useful. It seems generic enough too.

Martin Blais wrote:
Hi
Just wondering, would anyone think of it as a good idea if the enumerate() builtin could accept a "start" argument? I've run across a few cases where this would have been useful. It seems generic enough too.
+1, but something more useful might be a a cross between enumerate a zip, where you pass N iterables and it yields N-tuples. Then you could do something like: zipyield(range(10, 20), mygenerator()) and it would be like you wanted for enumerate, but starting from 10 in this case. -Michel
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gman...

Michel Pelletier <michel@cignex.com> wrote:
Martin Blais wrote:
Hi
Just wondering, would anyone think of it as a good idea if the enumerate() builtin could accept a "start" argument? I've run across a few cases where this would have been useful. It seems generic enough too.
+1, but something more useful might be a a cross between enumerate a zip, where you pass N iterables and it yields N-tuples. Then you could do something like:
zipyield(range(10, 20), mygenerator())
and it would be like you wanted for enumerate, but starting from 10 in this case.
All of this already exists. from itertools import izip, count for i,j in izip(count(start), iterable): ... Read your standard library. - Josiah

On 10/19/05, Martin Blais <blais@furius.ca> wrote:
Just wondering, would anyone think of it as a good idea if the enumerate() builtin could accept a "start" argument?
And why not an additional "step" argument? Anyway, perhaps all this can be done with a 'xrange' object... -- Lisandro Dalcín --------------- Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) PTLC - Güemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594
participants (4)
-
Josiah Carlson
-
Lisandro Dalcin
-
Martin Blais
-
Michel Pelletier