python insert vs append
<p>I have written basic python snippets to first insert values in a list and then reverse them and what i found was there was a huge difference of speed of execution between insert and append methods. </p>

<p>Snippet 1:</p>

<pre><code>L = []
for i in range(10**5):
 L.append(i)
L.reverse()
</code></pre>

<p>Time taken to execute this :</p>

<pre><code>real    0m0.070s
user    0m0.064s
sys         0m0.008s
</code></pre>

<p>Snippet 2:</p>

<pre><code>l = []
for i in range(10**5):
 l.insert(0,i)
</code></pre>

<p>Time taken to execute:</p>

<pre><code>real    0m5.645s
user    0m5.516s
sys         0m0.020s
</code></pre>

<p>I expected the snippet 2 to perform much better than snippet1 , since i am performing the reverse operation directly by inserting the numbers before. But the time taken says otherwise.  I fail to understand , why does the latter method takes more time to execute , even though the method looks more elegant. does any one have any explanation for this ?</p>
