[issue20811] str.format for fixed width float can return a string longer than the maximum specified

Ned Deily report at bugs.python.org
Sat Mar 1 03:48:36 CET 2014


Ned Deily added the comment:

OK, so the issue is that Python float literals in the range 0.0 < x < 1.0 can be spelled without a "0" before the decimal point but the built-in format method for floats appears to always output the leading "0" even in cases where doing so cause the string to unnecessarily exceed the requested field width.  It does seem to be a bit of an edge case.  But I don't see anything in the current documentation or in PEP 3101 that addresses this case one way or another.  Eric, what's your take on this?

----------
nosy: +eric.smith
resolution: invalid -> 
stage: committed/rejected -> 
status: closed -> open

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


More information about the Python-bugs-list mailing list