[issue5686] Float formatting with no type code produces incorrect output for exponential notation

Mark Dickinson report at bugs.python.org
Sat Apr 4 15:14:27 CEST 2009


Mark Dickinson <dickinsm at gmail.com> added the comment:

I don't really see this as a bug in the behaviour.  I'd always understood 
the purpose of the "at least one digit after the decimal" to be to make it 
possible to visually distinguish floats and integers, in the same way that 
repr and str already do.

>>> repr(1e100)
'1e+100'
>>> repr(1e5)
'100000.0'

If an exponent's present then the string's already clearly not an integer, 
so there's no need for the '.0'.

----------

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


More information about the Python-bugs-list mailing list