Pythonic Referenced For Loop
<p>I have a <code>for</code> loop as follows:</p>

<pre><code>a=[1,2,3,4,5]
for i in a:
    i=6
</code></pre>

<p>What I would like is for every element of <code>a</code> to become <code>6</code>.</p>

<p>Now I know that this <code>for</code> loop won't do it, because I am merely changing the what <code>i</code> refers to.</p>

<p>I instead could write:</p>

<pre><code>a=[1,2,3,4,5]
for i in len(range(a)):
    a[i]=6
</code></pre>

<p>But that doesn't seem very Pythonic. What are good ways of doing this sort of thing? Obviously, setting everything to <code>6</code> is contrived example and, in reality, I would be doing more complicated (and wonderful) things. Therefore, answers should be generalised.</p>
