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

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Mar 17 22:41:11 CET 2009

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.

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.


More information about the Python-ideas mailing list