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

Nick Coghlan ncoghlan at gmail.com
Thu Mar 19 12:16:14 CET 2009


Steven D'Aprano wrote:
> But surely with Raymond and Mark's idea about passing a dict derived 
> from locale, this is no longer an issue? Are hard-coded separators 
> still on the table?

That's a separate discussion, not part of PEP 377. The comma in PEP 377
is hardcoded, just like the decimal point. If formatting becomes more
configurable it will be via a new PEP.

What I don't get here is that anyone writing "quick and dirty" scripts
that still needed locale appropriate output appropriate for
non-developer end users* already couldn't use %-formatting or str.format
for the task. The decimal point was wrong and there was no way at all to
insert a thousands separator.

If it's only a matter of localisation, then the locale module can do the
job and the affected developers are probably already using it. If it's a
matter of internationalisation, then that involves a lot more than just
a comma here and there, and again, affected developers will already be
using an appropriate tool.

The PEP provides a quick way to make big numbers more readable when the
intended audience is either the developer themselves (i.e. debugging
messages), or an audience of IT types (e.g. system administrators). Yes,
it is inadequate in many situations for formatting strings for display
to non-developer end users - that isn't a new problem, and PEP 377
doesn't make it any worse than it already was.

Cheers,
Nick.

*(Note that such scripts actually sound neither quick nor dirty to me -
as soon as you're producing output for non-developers you have to pay
far more attention to the formatting and other presentation aspects,
whether those readers are native English speakers or not)


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



More information about the Python-ideas mailing list