Why doesn't this for loop in Python take ages? : <p>I am running this little loop on a Jupyter notebook</p>

<pre><code>import time

def time_loop(reps):

    start = time.clock()
    count = 0
    for i in range(reps):
        count += 1
    return time.clock() - start

time_loop(10000^100)
</code></pre>

<p>No matter what I enter as an argument, I seem to always get an output around 0.003</p>

<pre><code>0.0031050000000050204
</code></pre>

<p>What is going on?</p>

<p>One guess is that python understands that the result of the loop will simply be count = reps, and quits the loop?</p>

<p>But if I run this instead</p>

<pre><code>import time
import numpy as np

def time_loop(reps):

    start = time.clock()
    count = 0
    for i in range(reps):
        count += np.sin(reps)
    return time.clock() - start

time_loop(10000^100)
</code></pre>

<p>It does take longer as I increase the argument, even though the result of the loop is still quite simply count = reps*sin(reps).</p>
