On 20 juil, 09:29, Ian Kelly <ian.g.ke...@gmail.com> wrote: > Otherwise, here's another non-DRY solution: > > >>> from itertools import izip > >>> for i, c in izip(reversed(xrange(len(s))), reversed(s)): > > ... > > Unfortunately, this is one space where there just doesn't seem to be a > single obvious way to do it.
Well, I see. Thanks. There is still the old, brave solution, I'm in fact using. >>> s = 'abcd' >>> for i in xrange(len(s)-1, -1, -1): ... print i, s[i] ... 3 d 2 c 1 b 0 a >>> --- DRY? acronym for ? -- http://mail.python.org/mailman/listinfo/python-list