summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/decimal.py5
-rw-r--r--Lib/test/test_decimal.py3
2 files changed, 6 insertions, 2 deletions
diff --git a/Lib/decimal.py b/Lib/decimal.py
index e3fa8cb..33f5391 100644
--- a/Lib/decimal.py
+++ b/Lib/decimal.py
@@ -5577,7 +5577,10 @@ def _parse_format_specifier(format_spec, _localeconv=None):
raise ValueError("Alignment conflicts with '0' in "
"format specifier: " + format_spec)
format_dict['fill'] = fill or ' '
- format_dict['align'] = align or '<'
+ # PEP 3101 originally specified that the default alignment should
+ # be left; it was later agreed that right-aligned makes more sense
+ # for numeric types. See http://bugs.python.org/issue6857.
+ format_dict['align'] = align or '>'
# default sign handling: '-' for negative, '' for positive
if format_dict['sign'] is None:
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py
index e3e50f0..39a0ad5 100644
--- a/Lib/test/test_decimal.py
+++ b/Lib/test/test_decimal.py
@@ -701,6 +701,7 @@ class DecimalFormatTest(unittest.TestCase):
('', '1.00', '1.00'),
# test alignment and padding
+ ('6', '123', ' 123'),
('<6', '123', '123 '),
('>6', '123', ' 123'),
('^6', '123', ' 123 '),
@@ -730,7 +731,7 @@ class DecimalFormatTest(unittest.TestCase):
(',', '-1234567', '-1,234,567'),
(',', '-123456', '-123,456'),
('7,', '123456', '123,456'),
- ('8,', '123456', '123,456 '),
+ ('8,', '123456', ' 123,456'),
('08,', '123456', '0,123,456'), # special case: extra 0 needed
('+08,', '123456', '+123,456'), # but not if there's a sign
(' 08,', '123456', ' 123,456'),