cross platform use of set locale

Scott David Daniels Scott.Daniels at Acm.Org
Wed Mar 23 14:41:57 CET 2005

Timothy Smith wrote:
> Serge Orlov wrote: ...
>>   d = Dollars(1000000.01)
>>   print "You have %s in your account" % d
>> and get
>>   You have $1,000,000.01 in your account.

> thats exactly what i'm trying to do, only having to do that for all my 
> outputs is more work then i'd like :/
> why is this a misuse of locale? it's exactly what locale is meant for 
> isn't it?

locale is so that you can write code that runs several different places
and obeys local conventions on output at each of those places.  Not so
much for formatting how you like (which would be easier to write and
control yourself).  Just write a function "commad" and use it.

--Scott David Daniels
Scott.Daniels at Acm.Org

More information about the Python-list mailing list