On 1/28/2018 6:51 AM, Nick Coghlan wrote:
On 28 January 2018 at 19:30, Stephan Houben <stephan...@gmail.com> wrote:
Hi David,

Perhaps the "n" locale-dependent number formatting specifier
should accept a , to have locale-appropriate formatting of thousand
separators?

f"{x:,n}"

would Do The Right Thing(TM) depending on the locale.

Checking https://www.python.org/dev/peps/pep-0378/, we did suggest
using the locale module for cases where the engineering style
groups-of-three structure wasn't appropriate, with the parallel being
drawn to the fact that you also need to use locale dependent
formatting to get a decimal separator other than ".".

If I recall correctly, we discussed this at the time, and the problem with locale is that it's not thread safe. I agree that if it were, it would be nice to be able to use it, either with 'n', or in some other mode just for grouping.

The underlying C setlocale()/localeconv() just isn't very friendly to this use case.

Eric.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to