[Python-Dev] PEP 3101: floats format 'f' and 'F'
Eric Smith
eric+python-dev at trueblade.com
Thu Jul 17 17:38:41 CEST 2008
Eric Smith wrote:
> Guido van Rossum wrote:
>
>>> It shares code with %-formatting. Change that, too? I couldn't find
>>> any
>>> occurrences of %F in the stdlib. Not that that's the entire
>>> universe, of
>>> course.
>>>
>>> The change is slightly less elegant if I don't change %-formatting, but
>>> still doable, especially if the betas don't get cut today.
>>
>> Fine with me to change %F as well -- after all that's where the
>> misunderstanding comes from. (More and more I'm beginning to think it
>> was my mistake. :-)
>
> I added this as
> http://mail.python.org/pipermail/python-dev/2008-July/081242.html
>
> I should be able to get it checked in today.
I have this ready for checkin (with docs and tests). I'd like to get it
in for this beta, since it does involved changed behavior, no matter how
small ('1e+100' becomes '1E+100' with '%F'). But it relies on the
platform's vsnprintf to do the right thing with 'F', so I'm worried
about breakages on platforms I don't have access to. Resolving those
issues might take a few days.
Any advice on checking this in now, or waiting until after this beta is
released?
On a related note, I've wanted to clean up float formatting for ages.
The test:
if ((type == 'f' || type == 'F') && (fabs(x) / 1e25) >= 1e25)
is in the code in 3 places, for example. I'm hoping I can get to that
project, but since it won't change functionality I can do it later.
Eric.
More information about the Python-Dev
mailing list