On 7/20/05, Simon Brunning <[EMAIL PROTECTED]> wrote: > On 7/20/05, Mage <[EMAIL PROTECTED]> wrote: > > Or is there better way? > > > > for (i, url) in [(i,links[i]) for i in range(len(links))]: > > for i, url in enumerate(links): >
+2 for creating seeing a need and crafting a reasonable solution, but -1 for not reading the section on builtins to see if it existed already. (As for its pythonicity, I would have recommended isolating it into a function and making it a generator: def my_enumerate(enumerable): i = 0 for elt in enumerable: yield (i, elt) i += 1 for i, url in my_enumerate(links): but it's not too bad as it is. Also, my function is completely untested - it's close to right though.) Peace Bill Mill -- http://mail.python.org/mailman/listinfo/python-list