On 2007-06-04, Michael Hoffman <[EMAIL PROTECTED]> wrote: > Wildemar Wildenburger wrote: >> While that is true, I guess it is commonplace to use i, j, k >> and n (maybe others) in constructs like >> >> for i in range(len(data)): >> do_stuff(data[i]) >> >> Or should the good python hacker do that differently? Hope not >> ;). > > Well, yes, I would do: > > for item in data: > do_stuff(item) > > or, if using enumerate: > > for item_index, item in enumerate(data): > do_stuff(item_index, item) > > I agree with Bruno that i and j should be used only for > indices, but I'm usually less terse than that.
I find i and j preferable to overly generic terms like "item." -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list