what's different about loop data with yield and without yield
<p>I have two ways to loop data, one using with <em>for loop</em>  another with <em>yield</em>, I want to know what's the difference.</p>

<ol>
<li><p>For Loop(get 100000 data)</p>

<pre><code>data='select 100000 data from database'

for d in date:
    do something with d    
</code></pre></li>
<li><p>yield (get 1000 data every time,then query database 100 times)</p>

<pre><code>def func():
    data='select 1000 data from database'
    while date.count&gt;0:
        yield data

data = func()   
for d in data:
    do something with d
</code></pre></li>
</ol>
