What do you call the item of list when used as an iterator in a for loop?
<p>I'm not sure how you name the <code>n</code> in the following <code>for</code> loop. Is there are a term for it? </p>

<pre><code>for n in [1,2,3,4,5]:
    print i
</code></pre>

<p>And, am I correct that the list itself is the <code>iterator</code> of the <code>for</code> loop ? </p>

<p>The example you gave is an <a href="https://en.wikipedia.org/wiki/For_loop#Iterator-based_for-loops" rel="nofollow">"iterator-based for-loop"</a></p>

<p><code>n</code> is called the <code>loop variable</code>.</p>

<p>The role that <code>list</code> plays is more troublesome to name.</p>

<p>Indeed, after an interesting conversation with @juanpa.arrivillaga I've concluded that there simply isn't a "clearly correct formal name", nor a commonly used name, for that syntactic element.</p>

<p>That being said, I do think that if you referred to it in context in a sentence as "the loop iterator" everyone would know what you meant.</p>

<p>In doing so, you take the risk of confusing yourself or someone else with the fact that the syntactic element in that position is not in fact an iterator, its a collection or (loosely, but from the definition in the referenced article) an "iterable of some sort".</p>

<p>I suspect that one reason why there isn't a name for this is that we hardly ever have to refer to it in a sentence.  Another is that they types of element that can appear in that position vary widely, so it is hard to safely cover them all with a label. </p>

python terminology