Could someone walk me line-by line through this prime sieve? I'm attempting to develop my own sieve but most of the faster ones contain syntax that I don't understand (like the lines i've made comments on). Sorry if this is sort of a newbie question -- also if you have any links that could help me with sieve writing they'd be greatly appreciated.
def rwh_primes1(n):
""" Returns a list of primes < n """
sieve = [True] * (n/2) # What does the '[True]' mean?
for i in xrange(3,int(n**0.5)+1,2):
if sieve[i/2]: # The same complaint as in line 3, I don't understand the variable 'sieve'
sieve[i*i/2::i] = [False] * ((n-i*i-1)/(2*i)+1) # how is sieve used here - it seems to be as a list but i'm unsure
return [2] + [2*i+1 for i in xrange(1,n/2) if sieve[i]] # 'sieve' is confusing me here yet again.