[Python-Dev] LC_NUMERIC and C libraries (original) (raw)
Martin v. L�wis martin@v.loewis.de
18 Jul 2003 00:49:08 +0200
- Previous message: [Python-Dev] LC_NUMERIC and C libraries
- Next message: [Python-Dev] LC_NUMERIC and C libraries
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Christian Reis <kiko@async.com.br> writes:
The underlying truth is that locale-represented values will not be directly convertible to Python's C-locale values.
That is not true. locale.atof should allow you to parse the string.
I'm not sure this is correct. If it isn't I suggest two alternatives: offer an additional float() that does support LCNUMERIC (floatlocalized?), or change float() semantics.
I think this is unacceptable. In some languages, "." is used as the thousands-separator. Then, should "1.000" be 1e3, or 1e0?
There may be [broken] code that relies on float raising a TypeError if something like "50,00" is passed to it, however. Other than that it seems safe as a special-case.
That code is not broken: It is a feature that float() accepts exactly the same syntax that you use in source code; see the documentation for string.atof.
Regards, Martin
- Previous message: [Python-Dev] LC_NUMERIC and C libraries
- Next message: [Python-Dev] LC_NUMERIC and C libraries
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]