Eric V. Smith added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21195>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to