locale.nl_langinfo(RADIXCHAR) vs locale.localeconv()['decimal_point']

Jeff Epler jepler at unpythonic.net
Sat Aug 30 04:12:59 CEST 2003

I'd expect these two to be identical, but they don't seem to be.

[This session from 2.2.2 on RedHat Linux 9; same behavior in 2.3b1]
>>> import locale
>>> locale.setlocale(locale.LC_ALL, "fr_FR")
>>> locale.nl_langinfo(locale.DAY_1)
>>> # Okay, we *are* in France now
>>> locale.localeconv()['decimal_point']
>>> # Yep, they use this in place of the decimal point
>>> locale.nl_langinfo(locale.RADIXCHAR)
>>> # But not if you use nl_langinfo() !?

I know that Python plays some nasty games under the covers with
LC_NUMERIC, but I would expect the "emulated" LC_NUMERIC to extend
to locale.nl_langinfo().  The documentation (doc/lib/module-locale.html
or pydoc locale) doesn't reflect this limitation of nl_langinfo() as
far as I can tell.

Should I file an SF bug over this, am I confused about what's going on,
or will this likely be fixed anyway in 6.4?  It's not a pressing need
for me, since code can just use localeconv() anyway (or locale.atof and
friends, for that matter)...


More information about the Python-list mailing list