In Python, When yield cost over the return an list?
<p>In many case, people all ways say "use the <code>yield</code> to lazily create element."
but I think everything have cost, include the <code>yield</code> and its iterator.</p>

<p>In effective nord eyes, I think it's nice question.
so,for example, when I get an function.</p>

<pre><code>def list_gen(n):
    if n &gt; MAGIC_NUM:
        return xrange(n)
    else:
        return range(n)
</code></pre>

<p>How much dose the MAGIC_NUM is?</p>

<p><strong>UPDATE</strong> sorry for this mistake, I'm origin meaning is compare the iterator's cost and list cost.</p>

<p><strong>UPDATE AGAIN</strong> Please imaging an case. Whether have an condition, that the memory so limit that it's can't create an iterator. </p>

<p>ha, this question is more funny now.<br>
<strong>UPDATE AGAIN</strong> Why does create an iterator and save the yield context are less then create a list? or How much does iterator cost ?(sorry for my insult) How many bytes?</p>
