This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.smith
Recipients docs@python, eric.smith, lebigot, mark.dickinson
Date 2014-04-10.15:04:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1397142293.74.0.208420838357.issue21195@psf.upfronthosting.co.za>
In-reply-to
Content
The rule is:
- if the entire format specifier is the empty string (not None, but ''), then return str(value)
- else, look at the presentation type. if it is missing, set it to something like 'g'
- do the normal float formatting using the presentation type

The first of these has an empty string for the format specifier (so uses str(1e10), the rest do not:

>>> format(1e10, '')
'10000000000.0'
>>> format(1e10, ' ')
' 10000000000.0'
>>> format(1e10, ' g')
' 1e+10'
>>> format(1e10, ' e')
' 1.000000e+10'
>>> format(1e10, ' f')
' 10000000000.000000'

Now, how much the "something like g" part of the above is true is debatable.
History
Date User Action Args
2014-04-10 15:04:53eric.smithsetrecipients: + eric.smith, mark.dickinson, lebigot, docs@python
2014-04-10 15:04:53eric.smithsetmessageid: <1397142293.74.0.208420838357.issue21195@psf.upfronthosting.co.za>
2014-04-10 15:04:53eric.smithlinkissue21195 messages
2014-04-10 15:04:53eric.smithcreate