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

Ned Deily report at bugs.python.org
Fri Feb 28 23:32:04 CET 2014


Ned Deily added the comment:

I think you are misunderstanding the meaning of the width component (e.g. the 10 in your example) of a format specification.  As described in the documentation, width is a decimal integer defining the *minimum* field width, not the *maximum* field width.  As necessary, the generated field will be as long as necessary to represent the item as requested by the format spec, but it will be at least "width" characters long.

http://docs.python.org/3.3/library/string.html#format-specification-mini-language

----------
nosy: +ned.deily
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed

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


More information about the Python-bugs-list mailing list