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

Nick Coghlan ncoghlan at gmail.com
Mon Mar 16 13:03:41 CET 2009

Raymond Hettinger wrote:
> [Chris Rebert]
>> This thread continues to get more complicated by the day...
>> (Localization doth be *hard*)
> Good thing the PEP is *not* about localization :-)
> It does not attempt to cater to every possible way to write numbers.
> Instead, it offers a handful of choices for thousands groupings.
> At least one of those choices (perhaps spaces or underscores)
> should be readable and useful in many (though not all) contexts.

Emphatically agreed that this PEP shouldn't be targeted at end-user
output for a commercial product. There are plenty of good solutions for
that already in the l10n/i18n space. What is currently missing (and what
the PEP will provide) is the ability to easily output more readable
comparatively large integers for debugging output or quick and dirty
"internal" scripts that are not intended for wide distribution.

Having had my eyes glaze over attempting to decipher overly long
integers in debugging output, I look forward to the day when I no longer
have to write my own formatting functions to deal with that (even if the
time when I can use 2.7 or 3.1 day to day is still somewhere in the dim
distant future...)

On a completely different topic, I noticed that the PEP doesn't
currently state what the thousands separator means for bases other than
10 (i.e. octal, hex, binary). Is it ignored? Always delineates groups of
3 digits as for decimal numbers? Delineates an "appropriate" group size
(e.g. 3 for octal, 4 for hex and binary)?


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list