Stefan Krah added the comment:
3.2 has a better error message:
>>> "{:<06}".format(Decimal("1.2"))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.2/decimal.py", line 3632, in __format__
spec = _parse_format_specifier(specifier, _localeconv=_localeconv)
File "/usr/lib/python3.2/decimal.py", line 5600, in _parse_format_specifier
"format specifier: " + format_spec)
ValueError: Alignment conflicts with '0' in format specifier: <06
That's because '0' already has a special meaning:
"Preceding the width field by a zero ('0') character enables sign-aware
zero-padding for numeric types. This is equivalent to a fill character of '0'
with an alignment type of '='."
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue17247>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com