documentation bug? (format spec mini language)

Terry Reedy tjreedy at udel.edu
Tue May 11 17:05:19 EDT 2010


On 5/11/2010 3:19 PM, MRAB wrote:
> Alan G Isaac wrote:
>> The documentation at
>> http://docs.python.org/py3k/library/string.html#format-specification-mini-language
>>
>>
>> '<' Forces the field to be left-aligned within the available space
>> (This is the default.)
>>
>> The conflicting example::
>>
>> >>> format(3.2,'10.5f')
>> ' 3.20000'
>> >>> format(3.2,'<10.5f')
>> '3.20000 '
>>
>> Am I somehow misreading the documentation?
>>
> It does look misleading. Numbers default to right-aligned, as you
> discovered.
>
> You usually want numbers to be right-aligned so that the decimal points
> line up when writing a columns of them.

http://bugs.python.org/issue8691




More information about the Python-list mailing list