On 2016-08-26 14:34, Chris Angelico wrote:
On Fri, Aug 26, 2016 at 10:47 PM, Steven D'Aprano <st...@pearwood.info> wrote:
[snip]
Or if that's too heavy (two whole characters, plus the suffix!) perhaps
we could have a rule that the suffix must follow the final underscore
of the number:

8_M  # int 8*10*6
123_456_789_M  # int 123456789*10**6
123_M_456  # still an error
8._M  # float 8.0*10**6

This sounds better IMO. It's not legal syntax in any version of Python
older than 3.6, so there's minimal backward compatibility trouble.

According to Wikipedia, it's recommended that there be a space between the number and the units, thus not "1kg" but "1 kg".

As we don't put spaces inside numbers in Python, insisting on an underscore instead would seem to be a reasonable compromise.

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to