Issue 2526: str.format() :n format does not appear to work for int and float (original) (raw)
Issue2526
Created on 2008-04-01 11:35 by mark, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Messages (5) | ||
---|---|---|
msg64804 - (view) | Author: Mark Summerfield (mark) * | Date: 2008-04-01 11:35 |
>>> # Py30a3 >>> import locale >>> locale.setlocale(locale.LC_ALL, "en_US.UTF8") 'en_US.UTF8' >>> locale.format("%d", 12345, True) '12,345' >>> "{0:n}".format(12345) '12345' According to the docs the 'n' format should use the locale-dependent separator, so I expected both strings to be '12,345'. Also, it is a pity that locale.format() uses the old deprecated % syntax rather than the much nicer and better str.format() syntax. | ||
msg64959 - (view) | Author: Neal Norwitz (nnorwitz) * ![]() |
Date: 2008-04-05 02:59 |
Eric, could you take a look? | ||
msg64968 - (view) | Author: Eric V. Smith (eric.smith) * ![]() |
Date: 2008-04-05 10:49 |
I'm looking into it. | ||
msg64974 - (view) | Author: Eric V. Smith (eric.smith) * ![]() |
Date: 2008-04-05 14:35 |
The same issue exists with floats: # continuing the example >>> locale.format("%g", 12345, True) '12,345' >>> "{0:n}".format(12345.0) '12345' The same issue exists in 2.6. | ||
msg65988 - (view) | Author: Eric V. Smith (eric.smith) * ![]() |
Date: 2008-04-30 01:10 |
Committed fix in r62586. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:56:32 | admin | set | github: 46778 |
2008-04-30 01:10:18 | eric.smith | set | status: open -> closedresolution: fixedmessages: + |
2008-04-05 14:35:32 | eric.smith | set | title: str.format() :n format does not appear to work -> str.format() :n format does not appear to work for int and floatmessages: + versions: + Python 2.6 |
2008-04-05 10:49:50 | eric.smith | set | messages: + |
2008-04-05 02:59:06 | nnorwitz | set | priority: highassignee: eric.smithmessages: + nosy: + eric.smith, nnorwitz |
2008-04-01 11:35:24 | mark | create |