On 2020-10-13 06:06, malin...@163.com wrote:
PEP 515 added underscore to numeric literals, it brings better readability.

     PEP 515 -- Underscores in Numeric Literals
     https://www.python.org/dev/peps/pep-0515/

Is it possible to add _KB, _MB, _GB to numeric literals, for example:

      200_KB   (200*1024)
      150_MB   (150*1024*1024)
      2_GB     (2*1024*1024*1024)
Do you think it's a good code style?

A couple of points:

1. 200_KB is really a size in bytes, not a number, if you see what I mean. In general, I'm -1.

2. The use of K/M/G as powers of 1024 is an old, though common, convention. These days it's recommended to keep those prefixes as powers of 1000 as in the metric system (SI) (although SI uses 'k' instead of 'K') and use Ki/Mi/Gi instead as powers of 1024.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/M7EGKWXHNIA745WB4OPSORQHR747SYHN/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to