[Python-Dev] PEP 485 review (isclose())

Chris Barker chris.barker at noaa.gov
Tue Mar 3 07:48:31 CET 2015


On Mon, Mar 2, 2015 at 10:39 PM, Guido van Rossum <guido at python.org> wrote:

> It should be written in C. I thought you knew. :-)
>

It crossed my mind when we talked about the math module -- but I didn't
really think about it...

I guess it's okay to drop Decimal support (*). Complex support probably
> should be in cmath.
>

fair enough -- and easy enough to do if we do float-only in math, and
complex-only in cmath.


But this is an amendmend to the PEP as accepted. If anyone cares about
> these changes they should speak up, otherwise the PEP should be updated.
>

will do.


> (*) Adding it to the decimal module would require a discussion with
> Raymond Hettinger, but Decimal users can probably copy and paste the
> formula from the PEP.
>
>
yup -- but maybe worth putting in there while we're at it. though as
Decimal is arbitrary precision, maybe it's not needed....

-Chris



> On Monday, March 2, 2015, Chris Barker <chris.barker at noaa.gov> wrote:
>
>> On Fri, Feb 27, 2015 at 12:07 PM, Chris Barker <chris.barker at noaa.gov>
>> wrote:
>>
>>> I'll edit the text as you suggest,
>>>
>>
>> Done.
>>
>>
>>> and then work on a patch -- I'm sure I'll have questions for Python-dev
>>> when I actually do that, but I'll get started on my  own and see how far I
>>> get.
>>>
>>
>> OK --  big question 1:
>>
>> As far as I can tell, the math module is entirely a C extension. So I can:
>>
>> 1) write isclose() in C -- I could probably do that (It's been a while --
>> I'm a big Cython fan these days...) and I'd probably punt on having it work
>> with anything other than floats if I did that -- which would fit how most
>> of the match module works anyway.
>>
>> 2) Write it in Python, and monkey-patch it in to the math module -- I
>> honestly have no idea how to do that, but as I can add a new name to the
>> math module after importing it, it should be doable --but I have no idea
>> where the code would go.
>>
>> Suggestions??
>>
>> Thanks,
>>   -Chris
>>
>>
>>
>>
>>
>>
>>
>>
>>> -Chris
>>>
>>>
>>>
>>>
>>>
>>> On Fri, Feb 27, 2015 at 11:38 AM, Guido van Rossum <guido at python.org>
>>> wrote:
>>>
>>>> I think it's time to accept PEP 485. I've re-read it once more, and it
>>>> looks like the text is in great shape. (My only recommendation would be to
>>>> update the Abstract to state that we're specifically adding math.isclose().)
>>>>
>>>> A wording question: "This implementation has a flag that lets the user
>>>> select which relative tolerance test to apply -- this PEP does not suggest
>>>> that that be retained, but rather than the weak test be selected." -- I
>>>> think this was meant to say "... rather *that* the weak test be selected",
>>>> right? (It would be nice if the sample implementation defaulted to the
>>>> choice in the PEP.)
>>>>
>>>> However, those are just minor edits, and I hereby approve the PEP.
>>>> Thanks Chris and everyone else for the fruitful discussion (and thanks
>>>> especially to Chris for eventually ending the bikeshedding and writing a
>>>> PEP that explains each of the choices). Congrats!
>>>>
>>>> --
>>>> --Guido van Rossum (python.org/~guido)
>>>>
>>>
>>>
>>>
>>> --
>>>
>>> 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 at noaa.gov
>>>
>>
>>
>>
>> --
>>
>> 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 at noaa.gov
>>
>
>
> --
> --Guido van Rossum (on iPad)
>



-- 

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 at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150302/b9c89801/attachment.html>


More information about the Python-Dev mailing list