On 10/13/20 1:06 AM, 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?

That is easy enough to do with just a slight change in syntax:

KB = 1024

MB = 1024*1024

GB = 1024*1024*1024


200*KB

150*MB

2*GB


-- 
Richard Damon
_______________________________________________
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/7J6C7KWMQUXUF2GJZX34R6BTRV3MPP4F/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to