
On Fri, Jan 23, 2015 at 6:41 PM, Chris Angelico <rosuav@gmail.com> wrote:
On Sat, Jan 24, 2015 at 1:35 PM, Andrew Barnert <abarnert@yahoo.com.dmarc.invalid> wrote:
Maybe the answer there is to have an is_close_to_0 function, instead of a parameter that's only useful if expected is 0? But then you might have, say, a comprehension where some of the expected values are 0 and some aren't, so maybe not...
That's a more philosophical question about API design. It's probably worth mentioning the two options in the PEP - separate function for "close to zero" with these args, or put it all into the one function with those args.
I could mention it -- though I started all this thinking that we should keep relative and absolute tolerance separate, then realized that relative was going to be useless for zero, so added the absolute tolerance to cover that (which I originally named zero_tol, but realized that it really was absolute everywhere...). Now that we're thinking that we can have a switch for the exactly zero case, then there may be no need to have an absoute tolerance parameter, but only relative and zero. Then you'd have a separate function (if you wanted) for absolute tolerance, so it could have a default -- that may be better than requiring the user to set the parameter to get an absolute tolerance test at all. I guess the key question is if someone would want both an relative tolerance and an absolute tolerance, aside from the zero issue. -Chris
ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
-- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov