After writing out the problem, the solution became pretty obvious. The contents of the list don't matter at all. It's all based on the number of the elements. >>> def g3(ll): x = len(ll) for i in range(0, x+1): xx = i/float(x) yield xx