Gabriel Genellina <gagsl-...@yahoo.com.ar> wrote: >En Sun, 03 May 2009 17:41:49 -0300, Zentrader <zentrad...@gmail.com> >escribió: >> 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 > >Isn't so easy. You have representation errors and rounding errors here, >and they accumulate. [ ... ]
And remarkably quickly at that: >>> ctr = -10.5 >>> for i in range(-105, 106): ... i *= 0.1 ... if i != ctr: print repr(i), repr(ctr) ... ctr += 0.1 ... -10.0 -10.000000000000002 etc. -- \S under construction
-- http://mail.python.org/mailman/listinfo/python-list