[Python-Dev] Re: Be Honest about LC_NUMERIC [REPOST]

Tim Peters tim.one at comcast.net
Sun Aug 31 23:47:34 EDT 2003


[Tim, about what the patch does]
>> ...
>> 1. For string to double, preprocess the input string to change it to
>>    use current-locale spelling before calling the platform C
>>    strtod().

[Martin]
> I see (I was confused by the presence of a table of bytes).

Right, the table appears to be there just to support locale-independent
character classification.

> This is much worse, then: How can it possibly know what formats the C
> library expects in the current locale? What if the C library insists that
> a thousands-separator is used when the locale has one?  etc.

I'm not sure that's a realistic objection.  The patch appears to be trying
to replace only the decimal point (if any), with
localeconv()->decimal_point, and I've certainly not seen a locale that
refuses to accept, e.g.,

    1234 <its idea of a decimal point> 5678

meaning the same as

    1234.5678

in "C" locale.  The draft C99 standard I have handy here says (in its
strtod() section):

    In other than the "C" locale, additional locale-specific subject
    sequence forms may be accepted.

and "additional" implies to me that every locale must accept at least the
basic floating-point spellings described before that quoted sentence.




More information about the Python-Dev mailing list