[issue27772] Refer to actual format string when creating “zero padding” error message

Serhiy Storchaka report at bugs.python.org
Thu Dec 20 17:10:12 EST 2018


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

PR 11270 fixes this issue by making such format valid. Preceding the width field by '0' no longer affects the default alignment for strings, i.e. no longer sets the alignment to invalid '=' if it is not specified explicitly.

>>> format('abc', '<8')
'abc     '
>>> format('abc', '8')
'abc     '
>>> format('abc', '<08')
'abc00000'
>>> format('abc', '08')
'abc00000'

This does not contradict the documentation, which specifies this case for numeric types, but not for strings.

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue27772>
_______________________________________


More information about the Python-bugs-list mailing list