[docs] [issue15660] Clarify 0 prefix for width specifier in str.format doc,

py.user report at bugs.python.org
Wed Mar 16 22:38:34 EDT 2016


py.user added the comment:

There is a funny thing in 3.6.0a0

>>> '{:<09}'.format(1)
'100000000'
>>> '{:<09}'.format(10)
'100000000'
>>> '{:<09}'.format(100)
'100000000'
>>>

Actually, it behaves like a string, but the format should call internal format function of the passed number and the internal format function should not format different numbers as equal numbers.

Why does it represent number 1 as number 10?

>>> format(1, '<02')
'10'
>>> format(10, '')
'10'
>>>

I guess, there should be a restriction.
Zero padding for numbers should be correct.

----------

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


More information about the docs mailing list