*Naming Conventions*

Neil Cerutti horpner at yahoo.com
Mon Jun 11 13:56:25 EDT 2007


On 2007-06-11, Marius Gedminas <mgedmin at gmail.com> wrote:
> On Jun 6, 3:18 pm, Neil Cerutti <horp... at yahoo.com> wrote:
>> > Since 'i' and 'j' are canonically loop indices, I find it
>> > totally confusing to use them to name the iteration variable -
>> > which is not an index.
>>
>> Certainly i and j are just as generic, but they have the
>> advantage over 'item' of being more terse.
>
> Python programmers usually prefer readability over terseness.
> Finding a variable named 'i' that is not an integer index would
> be surprising to me.

Terseness and readability can go together in some circumstances,
though. But every case should be handled with taste and the
application experience, obviously. In a situation where 'i' might
be misleading I wouldn't use it.

-- 
Neil Cerutti



More information about the Python-list mailing list