translating foreign data

Marko Rauhamaa marko at pacujo.net
Sat Jun 23 08:03:10 EDT 2018


Richard Damon <Richard at Damon-Family.org>:
> If you know the Locale, then you do know what the decimal separator
> is, as that is part of what a locale defines.

I don't know what that sentence means.

> The issue is that if you just know the encoding, you don't necessarily
> know the locale.

I always know my locale. The locale is tied to the human user.

> He also commented that he didn't want to set the locale in the
> routine, as that sets it globally for the full application (but
> perhaps that latter could be fixed by first doing a
> locale.getlocale(), then setlocale for the files locale, and then at
> the end of reading and processing restore back the old locale.

Setting a locale application-wise is

 * not in accordance with the idea of a locale (the locale should be
   constant within a user session)

 * not easily possible (the locale is seen by all threads
   simultaneously)


BTW, I think the locale is a terrible invention.


Marko



More information about the Python-list mailing list