*Naming Conventions*

Neil Cerutti horpner at yahoo.com
Wed Jun 6 14:18:45 CEST 2007

On 2007-06-06, Bruno Desthuilliers
<bruno.42.desthuilliers at wtf.websiteburo.oops.com> wrote:
> Neil Cerutti a écrit :
>> On 2007-06-04, Michael Hoffman <cam.ac.uk at mh391.invalid> wrote:
>>> Wildemar Wildenburger wrote:
>>> 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."
> 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. 
> At least, 'item' suggests that it's an object, and a part of
> the collection - not just an index you'll have to use to
> subscript the container. Also, and as far as I'm concerned, I
> certainly dont find 'i' and 'j' *less* generic than 'item' !-)

Thanks, I didn't say clearly what I meant.

Certainly i and j are just as generic, but they have the
advantage over 'item' of being more terse.

I'm in the habit of letting context indicates wether i is a
contained object or a subscript. The advantage of a terse,
one-letter name is how it draws attention to context, rather than

But it's a small distinction. I wouldn't call 'item' a bad

Neil Cerutti

More information about the Python-list mailing list