Alan Kennedy wrote: > On jython 2.1, I use something like this > > #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > try: > enumerate > except NameError: > def enumerate(iterable): > results = [] ; ix = 0 > for item in iterable: > results.append( (ix, item) ) > ix = ix+1 > return results
at least in CPython, using a user-defined enumerate function is a bit slower than using the built-in version. in fact, if performance is important, the following can sometimes be the most efficient way to loop over things: ix = 0 for fibo in my_list: do something with ix and my_list[ix] ix += 1 </F> -- http://mail.python.org/mailman/listinfo/python-list