James Stroud wrote: > I think that it would be handy for enumerate to behave as such: > > def enumerate(itrbl, start=0, step=1): > i = start > for it in itrbl: > yield (i, it) > i += step > > This allows much more flexibility than in the current enumerate, > tightens up code in many cases, and seems that it would break no > existing code. Yes, I have needed this behavior with enumerate, like > tonight and the current example. I put the "step" parameter in for > conceptual symmetry with slicing. > > Here is a case use (or is it use case?):
Incidentally, I yesterday wrote a patch giving enumerate() a start parameter (and, more importantly, changing it so that it doesn't wraparound at sys.maxint). It can be found here: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1586315&group_id=5470 Georg -- http://mail.python.org/mailman/listinfo/python-list