python generators time complexity confusion
<p>I have been reading about keyword <code>yield</code> and generators in python and I want to know if I have understood it right it terms of time complexity.</p>

<p>Here is my generator function to get factors:</p>

<pre><code>def calc_factors(n):
    for k in range(0, n+1):     # this is the second "for" loop
        if n % k == 0:
           yield k
</code></pre>

<p>and I would call this generator function as:</p>

<pre><code>&gt;&gt;&gt; for factor in calc_factor(100):   # this is the first "for" loop
        print factor
</code></pre>

<p>Now my understanding is that this has time complexity of O(n^2) as it has two for loops but again I'm not convinced. Please enlighten me on this front.
Thanks in advance!</p>