[Python-ideas] PEP 485: A Function for testing approximate equality

Chris Angelico rosuav at gmail.com
Fri Feb 6 02:00:17 CET 2015


On Fri, Feb 6, 2015 at 11:56 AM, Chris Barker <chris.barker at noaa.gov> wrote:
> On Thu, Feb 5, 2015 at 4:40 PM, Chris Angelico <rosuav at gmail.com> wrote:
>>
>> > If we really believe that almost all people will be working with numbers
>> > of
>> > around a magnitude of 1, then we could set a default -- by why in the
>> > world
>> > are you using floating point numbers with a range of about 1e-300 to
>> > 1e300
>> > in that case?
>>
>> Because 'float' is the one obvious way to handle non-integral numbers
>> in Python. If you simply put "x = 1.1" in your code, you get a float,
>
>
> Fair enough -- more to the point -- we HAVE floats because we want folks to
> be able to use a wide range of values -- once we have that, we can't count
> on users generally only using a small part of that range.

Right. So crafting default tolerances for any particular "expected
range" isn't particularly safe.

+1 for the current behaviour of not specifying absolute tolerance.

ChrisA


More information about the Python-ideas mailing list