[Python-ideas] Format mini-language for lakh and crore

David Mertz mertz at gnosis.cx
Thu Feb 1 00:05:22 EST 2018


On Jan 31, 2018 8:12 PM, "Nick Coghlan" <ncoghlan at gmail.com> wrote:

On 1 February 2018 at 08:14, Eric V. Smith <eric at trueblade.com> wrote:
>>> print(f"In European format x is {x:,.2f}, in Indian format it is
{x:,2,3.2f}")

> This just seems too complicated to me, and is overgeneralizing. How many
of
> these different formats would ever really be used? Can you really expect
> someone to remember what that means by looking at it?

That's even more arbitrary and hard to interpret than listing out the
grouping spec, though.


I suggested a single character, although my thought of backtick was
different from Eric's of semicolon. Neither of them would be obvious, but
rather "something to look up the first few times."

There is a lot in the format mini-language that is "have to look up"
though. A single character South Asian number delimiter style wouldn't be
different from a lot of features of that DSL. Albeit, most of it seems
intuitive after you've used it a while... The symbols are somewhat iconic.

I think if we only cared about decimal digit groups (which is all I
initially thought of), Nick's would be excessive generalization. However,
when you think of also grouping hex, octal, and binary, there genuinely are
several conventions and different useful presentations.

So overall I do like Nick's approach better than my initial suggestion or
Eric's one that is similar to mine.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180131/a31e8d38/attachment.html>


More information about the Python-ideas mailing list