[Python-ideas] Python Float Update

Jim Witschey jim.witschey at gmail.com
Mon Jun 1 07:59:39 CEST 2015


On Sun, May 31, 2015 at 11:46 PM, Matthias Bussonnier
<bussonniermatthias at gmail.com> wrote:
> IIRC (during | after) the language submit at PyCon this year, it was said that maybe the stdlib should get
> less features, not more.

Rationals (and Decimals) already exist in the standard library. The
original proposal (as I read it, anyway) is more about the default
interpretation of, e.g., integer division and decimal-number literals.

> Side note, Sympy as a IPython ast-hook that will wrap all your integers into SymPy Integers and hence
> give you rationals of whatever you like, if you want to SymPy-plify your life.

Thank you for the pointer -- that's really cool.

> But for majority of use will it be useful ?

I believe interpreting "0.1" as 1/10 is more ergonomic than
representing it as 1.600000023841858 * (2^-4). I see it as being more
useful -- a better fit -- in most use cases because it's simpler, more
precise, and more understandable.

> What would be the performance costs ?

I don't know. Personally, I'd be willing to pay a performance penalty
to avoid reasoning about floating-point arithmetic most of the time,
then "drop into" floats when I need the speed.


More information about the Python-ideas mailing list