[issue6902] Built-in types format incorrectly with 0 padding.

Eric Smith report at bugs.python.org
Mon Sep 14 13:59:10 CEST 2009


Eric Smith <eric at trueblade.com> added the comment:

complex will also need to be addressed. The second error message is
misleading, for the same reason the formatting on float and int is
incorrect:

>> format(3-2j, "0<30")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Zero padding is not allowed in complex format specifier
>>> format(3-2j, "0=30")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Zero padding is not allowed in complex format specifier

But this is correct:
>>> format(3-2j, "=30")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: '=' alignment flag is not allowed in complex format specifier

It's not 0 padding that's not allowed, it's the implied sign alignment
when using 0 (without a specified alignment).

----------

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


More information about the Python-bugs-list mailing list