setlocale() in a module/extension library

Jarek Zgoda jzgoda at o2.usun.pl
Tue Aug 23 15:55:06 EDT 2005


Damien Elmes napisał(a):

> My question is this: it would be nice if every user of my library
> didn't need to add the above two lines to their code. But on the other
> hand, I'm unsure of the implications of modifying the locale from
> within a module, and it doesn't seem very clean. Would calling
> setlocale() from a library be a bad thing? If so, any alternative
> recommendations would be greatly welcome.

I think that many of them does that already, just to get proper display
on terminals, proper timezone settings etc. Anyway, setting locale in
library doesn't seem to be good, as this may change locale in global
application environment (what if user on system with Russian locale sets
application locale to de_DE to have german timezone settings?).

-- 
Jarek Zgoda
http://jpa.berlios.de/



More information about the Python-list mailing list