[issue21195] None float format: incomplete documentation

Eric V. Smith report at bugs.python.org
Thu Apr 10 15:18:48 CEST 2014


Eric V. Smith added the comment:

An empty format specifier can (and to my knowledge, does) match str(). So you get:

>>> format(1e10, '')
'10000000000.0'
>>> format(1e10, 'g')
'1e+10'
>>> str(1e10)
'10000000000.0'

The SO question is asking about an empty "presentation type", which is indeed similar to 'g' for floats.

I think this is all the same in 2.7 and 3.4, with the exception of how str() might operate on floats.

----------
nosy: +eric.smith

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21195>
_______________________________________


More information about the Python-bugs-list mailing list