On 6/23/18 10:05 AM, Peter J. Holzer wrote:
> On 2018-06-23 08:41:38 -0400, Richard Damon wrote:
>> On 6/23/18 8:28 AM, Peter J. Holzer wrote:
>>> On 2018-06-23 08:12:52 -0400, Richard Damon wrote:
>>>> On 6/23/18 7:46 AM, Steven D'Aprano wrote:
>>>>> If I'm in Australia, using the en-AU locale, nevertheless I can generate 
>>>>> a file using , as a decimal separator. Try and stop me :-)
>>>> yes, you can MIS-use the en-AU locale and write 1,000 to mean the number
>>>> One, just as you can misuse the language and write cat when you mean a
>>>> member of the Canine group, but then the misinterpretation is on the
>>>> creator of the document, not on the program that was told how the
>>>> document is to be read.
>>> How would he mis-use the en-AU locale to write 1 as "1,000"? I think
>>> to do that he would simply NOT use the locale.
>> Once you open the Locale can of worms, EVERYTHING has a locale, to say
>> you aren't using a locale is to say you are writing
>> something unintelligible, as you can thing of the locale as the set of
>> rules to interpret
> I don't think that's a useful way to look at it. "Locale" in
> (non-technical) English means "place" or "site". The idea behind the
> locale concept is that some conventions (e.g. how to write numbers or
> how to write strings) depend on the place where the program runs (or
> maybe where the user is sitting or grew up or maybe where a file was
> produced).
>
> For stuff which doesn't depend on the place (e.g. how a Python program
> should be parsed), the locale concept doesn't apply.
>
The Locale should NOT be the place the computer is running in (at least
not anymore), but where the data and the user are from (which can be
different). Do your really mean that when I travel to a place that uses
. as the thousands separator and , as the decimal separator (instead of
my normal environment when they are the other way around) all my
programs should immediately change how they read all my data files and
how I need to enter data? I hope not. I want my computer to use the
Locale of where "I" came from (not current am) to talk to me, and to be
able to set the Locale to interpret data to match the rules the person
who generated them used to generate them, so if they swap . and ,
compared to me, I can tell the program that. Your last parenthetical
comment in the first paragraph is my key point, the locale used to read
data should match the locale used to generate it, and that can easily be
different than the locale being used to interact with the user.

If a program doesn't care about the locale it is running in, like a
Python compiler, the either it needs to use routines that totally ignore
the locale or it needs to set the locale to one that matches the rules
it wants.

-- 
Richard Damon

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to