List conversion - inplace
<p>I am trying to convert ['1','2','3','4'] to [1,2,3,4]
I want to make this conversion inplace. Is it possible to do it? If not, what is the optimal solution.</p>

<p>This should be pretty much in-place?</p>

<pre><code>In [31]: l = ['1','2','3','4']

In [32]: for i in range(len(l)):
   ....:     l[i] = int(l[i])
   ....:     

In [33]: l
Out[33]: [1, 2, 3, 4]
</code></pre>

<p>Or, you could do it by using <code>enumerate</code> which takes an iterable (like a <code>list</code>) and returns an <code>index</code> and the corresponding value from the beginning till the end:</p>

<pre><code>In [84]: l = ['1','2','3','4']

In [85]: for idx, val in enumerate(l):
   ....:     l[idx] = int(val)
   ....:     

In [86]: l
Out[86]: [1, 2, 3, 4]
</code></pre>

python arrays list in-place