[Python-Dev] One more proposed formatting change for 3.1
p.f.moore at gmail.com
Tue Apr 28 15:19:55 CEST 2009
2009/4/28 Mark Dickinson <dickinsm at gmail.com>:
> Here's one more proposed change, this time for formatting
> of floats using format() and the empty presentation type.
> To avoid repeating myself, here's the text from the issue
> I just opened:
> In all versions of Python from 2.6 up, I get the following behaviour:
>>>> format(123.456, '.4')
>>>> format(1234.56, '.4')
>>>> format(12345.6, '.4')
> The first and third results are as I expect, but the second is somewhat
> misleading: it gives 5 significant digits when only 4 were requested,
> and moreover the last digit is incorrect.
> I propose that Python 2.7 and Python 3.1 be changed so that the output
> for the second line above is '1.235e+03'.
> This issue seems fairly clear cut to me, and I doubt that there's been
> enough uptake of 'format' yet for this to risk significant breakage. So
> unless there are objections I'll plan to make this change before this
> weekend's beta.
More information about the Python-Dev