[Python-Dev] Backport new float repr to Python 2.7?
robert.kern at gmail.com
Sun Oct 11 22:43:31 CEST 2009
Guido van Rossum wrote:
> On Sun, Oct 11, 2009 at 11:28 AM, Mark Dickinson <dickinsm at gmail.com> wrote:
>> In a recent #python-dev IRC conversation, it was suggested that we
>> should consider backporting the new-style float repr from py3k to
>> trunk. I'd like to get people's opinions on this idea.
>> Possible problems:
>> - breaking docstrings in third party code. Though Eric reminded me
>> that when we implemented this for 3.1, there were essentially no
>> standard library test breakages resulting from the changed repr
> I think you mean doctests? These are the primary reason I've always
> been hesitant to change this in 2.x.
I think that doctests inherently unsuited to testing floating point algorithms.
Leaving aside the platform differences in actual floating point arithmetic that
cause minute real differences in the results, Python 2.x relies on string
conversion routines which give different doctest results on different platforms.
Using a consistent routine would actually improve the ability to use doctests in
that one regard. It certainly would make writing examples much more consistent,
particularly for those of us that use infs and nans frequently.
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-Dev