[Python-Dev] PEP 515: Underscores in Numeric Literals (original) (raw)

Glenn Linderman v+python at g.nevcal.com
Thu Feb 11 14:04:20 EST 2016


On 2/11/2016 12:22 AM, Georg Brandl wrote:

Hey all,

based on the feedback so far, I revised the PEP. There is now a much simpler rule for allowed underscores, with no exceptions. This made the grammar simpler as well.

+1 overall

Examples::

# grouping decimal numbers by thousands amount = 10000000.0 # grouping hexadecimal addresses by words addr = 0xDEADBEEF # grouping bits into bytes in a binary literal nybbles, not bytes, is shown... which is more readable, and does group into bytes also. flags = 0b0011111101001110

+1 on 0b_ and 0X_ and, especially, 0O_ (but why anyone would use uppercase base designators is beyond me, as it is definitely less readable)

# making the literal suffix stand out more imag = 1.247812376e-15j

+1 on _j

-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20160211/533488f9/attachment.html>



More information about the Python-Dev mailing list