'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.

Eric.
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to