On Tue, Sep 27, 2011 at 2:53 PM, Guido van Rossum <gu...@python.org> wrote: > On Tue, Sep 27, 2011 at 11:48 AM, Alexander Belopolsky > <alexander.belopol...@gmail.com> wrote: >> On Tue, Sep 27, 2011 at 2:36 PM, Guido van Rossum <gu...@python.org> wrote: >> .. >>> But that's exactly what we don't *want* you to do! Because (unless you >>> are a numerical wizard) you probably aren't doing the error analysis >>> needed to avoid the "unexpected extra point" problem due to floating >>> point inaccuracies. For your own good, we want you to state the count >>> and let us deliver the number of points you want.
I don't disagree that the ability to provide count= option is useful. I am just saying that there are also cases where float step is known exactly and count (or stop) can be deduced from stop (or count) without any floating point issues. Iteration over integers that happen to be represented by floats is one use case, but using integer range may be a better option in this case. In US it is still popular to measure things in power of two fractions. Simulating a carpenter's yard does not suffer from rounding when done in floats. Counting by .5 and .25 has its uses too. Maybe frange() should just signal the FP inexact exception if we expect users to need hand holding to such a degree. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com