homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: str.format("{0:n}") poss. bug with setlocale()
Type: behavior Stage:
Components: Interpreter Core Versions: Python 3.0, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: eric.smith Nosy List: eric.smith, mark, talin
Priority: normal Keywords:

Created on 2008年06月19日 13:02 by mark, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Messages (3)
msg68403 - (view) Author: Mark Summerfield (mark) * Date: 2008年06月19日 13:02
Python 30b1
>>> import locale
>>> locale.setlocale(locale.LC_ALL, "en_US.UTF-8")
'en_US.UTF-8'
>>> for x in
(1234,12345,123456,1234567,12345678,123456789,1234567890,12345678900):
	print("[{0:>20n}]".format(x))
	
[ 1,234]
[ 12,345]
[ 123,456]
[ 1,234,567]
[ 12,345,678]
[ 123,456,789]
[ 1,234,567,890]
[ 12,345,678,900]
I expected that the commas would not increase the width, but maybe this
was the intended behaviour?
msg68408 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2008年06月19日 13:40
I'd say that's a bug. I'll look at it.
msg68676 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2008年06月24日 11:21
Fixed in r64499 (trunk) and r64500 (py3k).
I now get:
>>> import locale
>>> locale.setlocale(locale.LC_ALL, "en_US.UTF-8")
'en_US.UTF-8'
>>> for x in
(123,1234,12345,123456,1234567,12345678,123456789,1234567890,12345678900):
... print("[{0:>20n}]".format(x))
... 
[ 123]
[ 1,234]
[ 12,345]
[ 123,456]
[ 1,234,567]
[ 12,345,678]
[ 123,456,789]
[ 1,234,567,890]
[ 12,345,678,900]
and:
>>> for x in
(123,1234,12345,123456,1234567,12345678,123456789,1234567890,12345678900):
... print("[{0:>10n}]".format(x))
... 
[ 123]
[ 1,234]
[ 12,345]
[ 123,456]
[ 1,234,567]
[12,345,678]
[123,456,789]
[1,234,567,890]
[12,345,678,900]
History
Date User Action Args
2022年04月11日 14:56:35adminsetgithub: 47390
2008年06月24日 11:21:37eric.smithsetstatus: open -> closed
resolution: fixed
messages: + msg68676
2008年06月19日 15:32:00eric.smithsetversions: + Python 2.6
2008年06月19日 13:40:06eric.smithsetnosy: + talin
messages: + msg68408
components: + Interpreter Core
2008年06月19日 13:15:12benjamin.petersonsetassignee: eric.smith
nosy: + eric.smith
2008年06月19日 13:02:12markcreate

AltStyle によって変換されたページ (->オリジナル) /