[Python-Dev] Deprecating float.is_integer()

Guido van Rossum guido at python.org
Wed Mar 21 11:08:22 EDT 2018


I searched 6M LoC of Python code at Dropbox and found only three uses. They
seem legit. Two are about formatting a number that's given as a float,
deciding whether to print a float as 42 or 3.14. The third is attempting a
conversion from float to integer where a non-integer must raise a specific
exception (the same function also supports a string as long as it can be
parsed as an int).

I don't doubt we would get by if is_integer() was deprecated.


On Wed, Mar 21, 2018 at 3:31 AM, Chris Barker <chris.barker at noaa.gov> wrote:

>
>> Does anybody know examples of the correct use of float.is_integer() in
>> real programs? For now it looks just like a bug magnet. I suggest to
>> deprecate it in 3.7 or 3.8 and remove in 3.9 or 3.10.
>
>
> +1
>
> It really doesn’t appear to be the right solution for any problem.
>
> -CHB
> --
>
> 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
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> guido%40python.org
>
>


-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180321/14c6b261/attachment.html>


More information about the Python-Dev mailing list