translating foreign data

Richard Damon richard.damon at 1
Sat Jun 23 09:41:38 EDT 2018


From: Richard Damon <Richard at Damon-Family.org>

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:
>>> On Sat, 23 Jun 2018 06:26:22 -0400, Richard Damon wrote:
>>>> If you know the Locale, then you do know what the decimal separator is,
>>>> as that is part of what a locale defines.
>>> A locale defines a set of common cultural conventions. It doesn't mandate
>>> the actual conventions in use in any specific document.
>>>
>>> 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 think there are very good reasons to ignore the locale for specific
> purposes. For example, a Python interpreter should not use the locale
> when parsing Python, and a program producing Python should also ignore
> the locale.
Python, like many languages, define the formatting of things, so Python
programs should be interpreted according to the "Python" locale (which may
actually be named "C").
>
> You two also seem to be writing about different things when you write
> "THE locale". Steven seems to mean the global settings a user has
> chosen, you seem to mean the specidic settings appropriate for parsing a
> specific file.
>
>         hp
>
You have THE locale for a given piece of data. My point is that Python has
adopted the C method of a single global locale for a program, so in the program
 there is a 'THE Locale' which may actually need to be different when
processing different information, leading to some of the issues.

--
Richard Damon

--- BBBS/Li6 v4.10 Toy-3
 * Origin: Prism bbs (1:261/38)



More information about the Python-list mailing list