[Python-3000] Adding 'n' format presentation type to integers
Eric Smith
eric+python-dev at trueblade.com
Sun May 11 05:16:56 CEST 2008
Eric Smith wrote:
> 'n' is like 'g', but adds locale-specific thousands separators.
>
> Issue 2802 (http://bugs.python.org/issue2802) points out that 'n'
> formatting isn't useful for integers, because it first converts to
> float. There's no way to get 1,000,000 as a result, since 'g' converts
> to '1e+06'.
>
> I propose adding 'n' as an integer format presentation type to PEP 3101.
> The definition would be:
>
> 'n' - Number. This is the same as 'd', except that it uses the
> current locale setting to insert the appropriate
> number separator characters.
>
> I already have the C code needed to implement this in Python/pystrtod.c
> (for floats), so it would just take some refactoring to get the integer
> formatter to use it.
>
> If there is agreement, I'll update the PEP and implement this in 2.6 and
> 3.0.
Having heard no objections, I'll update the PEP and check in the change.
Eric.
More information about the Python-3000
mailing list