[Python-ideas] Python Float Update

Matthias Bussonnier bussonniermatthias at gmail.com
Mon Jun 1 05:46:03 CEST 2015


> On May 31, 2015, at 20:21, Jim Witschey <jim.witschey at gmail.com> wrote:
> 
> Teachable moments about the implementation of floating-point aside, something in this neighborhood has been considered and rejected before, in PEP 240. However, that was in 2001 - it was apparently created the same day as PEP 237, which introduced transparent conversion of machine ints to bignums in the int type.
> 
> I think hiding hardware number implementations has been a success for integers - it's a far superior API. It could be for rationals as well.
> 
> Has something like this thread's original proposal - interpeting decimal-number literals as fractional values and using fractions as the result of integer arithmetic - been seriously discussed more recently than PEP 240? If so, why haven't they been implemented? Perhaps enough has changed that it's worth reconsidering.

Why I see the interest, does it really belong in core Python ? What would be the advantages ?

IIRC (during | after) the language submit at PyCon this year, it was said that maybe the stdlib should get 
less features, not more. 

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. 

But for majority of use will it be useful ? What would be the performance costs ?

If you start into stroring rationals, then why not continued fraction, as they are just a N-tuple, instead of 2-tuples.
but then you are limited to non-infinite continued fraction. So you improve by using generator...
I love Python for doing science and math, but please stay away from putting too much in standard lib, 
or we will end up with cholesky matrix decomposition in Python 4.0 like Julia does… and I’m not sure it is a good idea.

I would much rather have a core set of library “blessed” by CPython that provide features like this one, 
that are deemed “important”.
— 
M



More information about the Python-ideas mailing list