[Python-ideas] Rough draft: Proposed format specifier for a thousands separator (discussion moved from python-dev)

Raymond Hettinger python at rcn.com
Thu Mar 12 20:02:07 CET 2009

> Raymond, aren't you equating "local" with the US?

Not at all.  "For local consumption" meant anything that isn't distributed
as a fully internationalized app.  Right now, all our reprs and string
interpolations are not locale-aware (i.e. float reprs are hardwired to use 
periods for the decimal separator).  Those tools are pretty useful to us
in day-to-day work.  I'm just proposing to extend those
non-locale-aware capabilities to include a thousands separator.

For a fully internationalized app, I would use something like Babel
which addresses the challenge in a comprehensive and uniform manner.

> The local module lets you take the locale as a separate parameter. I
> agree we should not try to duplicate it (though it's a bad API since
> it relies on global state -- that doesn't work very well in
> multi-threaded or web apps).
> But it does make sense for an accountant in France or Holland to
> hardcode her desire for a decimal comma and thousand-separating
> periods, as otherwise their boss won't be able to interpret the
> output.

Well said.


More information about the Python-ideas mailing list