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

Chris Angelico rosuav at gmail.com
Sat Jan 24 03:41:14 CET 2015


On Sat, Jan 24, 2015 at 1:35 PM, Andrew Barnert
<abarnert at 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.

ChrisA


More information about the Python-ideas mailing list