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

Bruce Leban bruce at leapyear.org
Thu Mar 12 19:17:06 CET 2009

> Make both the thousands separator and decimal separator user specifiable
> but not locale aware.

-1.0 as it stands (or -1,0 if you prefer)

When you say 'user' you mean 'developer'. Having the developer choose the
separators means it *won't* be what the user wants. Why would you stick in
separators if not to display to a user?

If I'm French then all decimal points should be ',' not '.' regardless of
what language the developer speaks, right?

A format specifier that says "please use the local-specific separators when
formatting this number" would be fine. We already have 'n' for this but
suppose we choose ';' as the character for this (chosen because it looks
like a '.' or a ',' which is are two of the three most common choices).

For example format(x, '6;d') == format(x, '6n') and you can use '';' with
any number type: format(x, '6;.3f') or format(x, '10;g').

I'd be inclined to always group in units of four digits if someone writes
format(x, '6;x').

--- Bruce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090312/c3e9e8be/attachment.html>

More information about the Python-ideas mailing list