On Sun, Jan 28, 2018 at 5:31 PM, David Mertz <[email protected]> wrote:
> I actually didn't know about `locale.format("%d", 10e9, grouping=True)`.
> But it's still much less general than having the option in the
> f-string/.format() mini-language. This is really about the formatted
> string, not necessarily about the locale. So, e.g. I'd like to be able to
> write:
>
>>>> print(f"In European format x is {x:,.2f}, in Indian format it is
>>>> {x:`.2f}")
>
> I don't want the format necessarily to be some pseudo-global setting, even
> if it can get stored in thread-locals. That said, having a locale-aware
> symbol for delimiting numbers in the format mini-language would also not be
> a bad thing.
I don't understand the format mini-language well enough to know what
would fit in, but maybe some way to (a) request localified formatting,
(b) some way to explicitly say which locale you want to use? Like if
"h" means "human friendly", it might be something like:
f"In the current locale x is {x:h.2f}, in Indian format it is {x:h(en_IN).2f}"
-n
--
Nathaniel J. Smith -- https://vorpus.org
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/