On Sun, 03 May 2009 13:41:49 -0700, Zentrader wrote: > There is no need for a function or a generator. A for() loop is a > unique case of a while loop > ## for i in range(-10.5, 10.5, 0.1): > ctr = -10.5 > while ctr < 10.5: > print ctr > ctr += 0.1
To match the semantics of range(), the final value to ctr must be less than but not equal to 10.5. >>> print ctr 10.6 Your solution does not do this -- it goes one steps too many, and then misleadingly fails to print the value. This is a bug waiting to hit, any time somebody runs your loop then goes to use ctr outside the loop. -- Steven -- http://mail.python.org/mailman/listinfo/python-list