Fixed point format for numbers with locale based separators

Eric V. Smith wrote:
If the locale character is "*", use locale-aware formatting for the given "type", with LC_NUMERIC. So, "*g" would be equivalent to the existing "n", and "*f" would give you the current "f" formatting, except using LC_NUMERIC for the decimal point. If the locale character is "$" use locale-aware LC_MONETARY. So then we could use "$g", "$f", etc. These locale characters would also work with int, so "*d" would make "n" obsolete (but I'm not proposing to remove it).
+1. I also think it's best to have a modifier and cover all cases.
But it's probably worth keeping '#' orthogonal to the locale character. Maybe someday we'll want to use them together.
Yes, somehow it feels right to keep them separate, even if we never use them together.
I think it might also require a PEP, but it would be as simple as PEP 378 for adding comma grouping formatting. Somewhere to memorialize the decision and how we got there, including rejected alternate proposals, would be a good thing.
It would be nice (if anyone wants to do the work), but your proposal is already perfect for me. I like the "*" and "$" choices. Stefan Krah
participants (1)
-
Stefan Krah