On 1 February 2018 at 14:11, Nick Coghlan <ncogh...@gmail.com> wrote: > On 1 February 2018 at 08:14, Eric V. Smith <e...@trueblade.com> wrote: >> On 1/29/2018 2:13 AM, Nick Coghlan wrote: >>> Given the example, I think a more useful approach would be to allow an >>> optional digit grouping specifier after the comma separator, and allow >>> the separator to be repeated to indicate non-uniform groupings in the >>> lower order digits. >>> >>> If we did that, then David's example could become: >>> >>> >>> 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? > > Sure - "," and "_" both mean "digit grouping", the numbers tell you > how large the groups are from left to right (with the leftmost group > size repeated as needed), and a single "," means the same thing as > ",3," for decimal digits, and the same thing as ",4," for binary, > octal, and hexadecimal digits.
Slight correction here, since the comma-separator is decimal only: - "," would be short for ",3," with decimal digits - "_" would be short for "_3_" with decimal digits - "_" would be short for "_4_" with binary/octal/hexadecimal digits Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/