PEP 378: Format Specifier for Thousands Separator

Ned Batchelder ned at nedbatchelder.com
Wed May 22 07:25:13 EDT 2013


On 5/21/2013 11:38 PM, Carlos Nepomuceno wrote:
>> From:steve+comp.lang.python at pearwood.info
>> >Subject: Re: PEP 378: Format Specifier for Thousands Separator
>> >Date: Wed, 22 May 2013 03:08:54 +0000
>> >To:python-list at python.org
> [...]
>>> >>So, the only alternative to have "'%,d' % x" rendering the thousands
>>> >>separator output would a C source code modification?
>> >
>> >That's one alternative. But the language you would be then running will
>> >no longer be Python.
>> >
>> >Another alternative would be to write a pre-processor that parses your
>> >Python source code, extracts any reference to the above, and replaces it
>> >with a call to the appropriate format call. But not only is that a lot of
>> >work for very little gain, but it's also more or less impossible to do in
>> >full generality. And again, what you are running will be something
>> >different than Python, it will be Python plus a pre-processor.
>> >
>> >
>> >Don't fight the language. You will lose.
> Not fighting the language. In fact it's not even a language issue.
> All I need is a standard library[1] improvement: "%,d"! That's all!

You have to keep in mind that 2.7 is not getting any new features, no 
matter how small they seem.  If you create a patch that implements the 
comma flag in %-formatting, it *might* go into 3.x, but it will not go 
into 2.7.

--Ned.



More information about the Python-list mailing list