Examples::">

(original) (raw)

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 = 10_000_000.0

# grouping hexadecimal addresses by words
addr = 0xDEAD_BEEF

# grouping bits into bytes in a binary literal



nybbles, not bytes, is shown... which is more readable, and does
group into bytes also.


 flags = 0b_0011_1111_0100_1110




+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-15_j




+1 on _j