What does the following segment do - Pyhon
<p>I have a problem with the following function. I can't understand what it does, because I'm new to Python, can you help me, please. Thanks in advance.</p>

<pre><code>def foo(limit):
    a = [True] * limit
    a[0] = a[1] = False
    for (i,b) in enumerate(a):
        if b:
        yield i
        for n in xrange(i*i,limit,i):
            a[n] = False
</code></pre>

<p>This is example of Binary Indexed Tree. </p>

python