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

Guido van Rossum guido at python.org
Tue Mar 17 22:50:46 CET 2009


On Tue, Mar 17, 2009 at 2:41 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Guido van Rossum wrote:
>>
>> (1) To avoid font-width issues -- many
>> variable-width fonts are designed so that all digits have the same
>> width, but their (default) space is much narrower.
>
> That's a good point.
>
> This alone doesn't necessarily rule out (A), though.
> It could be considered a case of user stupidity if they
> specify a field width that results in a comma at the
> beginning and don't like the result.

(A) is ruled out on the basis of aesthetics alone.

> It doesn't necessarily rule out (C) either, since there
> will always be a space at the beginning unless the value
> overflows, and then all your alignment guarantees are
> blown away anyhow.
>
>  (2) To avoid fraud
>>
>> when printing certain documents -- it's easier to insert a '1' in
>> front of a small number than to change a '0' into something else.
>
> However it's easy to add a '1' before a string of leading
> zeroes if there's a sliver of space available, so it's
> better still to fill with some other character such as
> '*'. You need a cooperative font for that to work.

What I've seen is the '$' sign immediately in front, e.g. $001,000.00.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-ideas mailing list