grantjenks / blue

The slightly less uncompromising Python code formatter.
https://blue.readthedocs.io/
Other
387 stars 21 forks source link

0x and 0b case #102

Open PhilipYip1988 opened 11 months ago

PhilipYip1988 commented 11 months ago

blue seems to be inconsistent to the Python interpreter for hex values. For example:

hex(2880744330)

returns:

0xabb4ab8a

Using blue on:

num1 = 0xabb4ab8a
num2 = 0xABB4AB8A
num3 = 0Xabb4ab8a 
num4 = 0XABB4AB8A

Gives:

num1 = 0xABB4AB8A
num2 = 0xABB4AB8A
num3 = 0xABB4AB8A 
num4 = 0xABB4AB8A

Python preferences lowercase hexadecimal because the upper case variations B and 8 look similar and A and 4 look similar increasing the chances of a transcription error:

blue_hex