PEP 260: simplify xrange()
sholden at holdenweb.com
Wed Jun 27 14:00:47 EDT 2001
"Dinu Gherman" <gherman at darwin.in-berlin.de> wrote in message
news:3B3A193F.AAFB31D5 at darwin.in-berlin.de...
> Michael Hudson wrote:
> > >>> len(frange(0,1.,0.1))
> > 11
> > >>> len(frange(0,1.,0.2))
> > 5
> So what?
Michael was just underlining the semi-random sequence lengths you will get
when using decimal floating-point representations. If you're aware of that
and it doesn't matter, then it doesn't matter :-) In integer-land one would
expect that len(range(x, i, y)) == len(range(10*x, 10*i, 10*y)) for all x, i
and y. This clearly wouldn't be true for frange().
More information about the Python-list