*Naming Conventions*
Wildemar Wildenburger
wildemar at freakmail.de
Mon Jun 4 17:20:13 EDT 2007
bruno.desthuilliers at gmail.com wrote:
> On Jun 4, 12:20 am, Ninereeds <stephenhorne... at aol.com> wrote:
>
>> First, for small loops with loop variables whose meaning is obvious
>> from context, the most readable name is usually something like 'i' or
>> 'j'.
>>
>
> 'i' and 'j' are the canonical names for for loops indices in languages
> that don't support proper iteration over a sequence. Using them for
> the iteration variable of a Python for loop (which is really a
> 'foreach' loop) would be at best confusing.
>
>
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 ;).
/W
More information about the Python-list
mailing list