This is a series of small posts about some interesting PEP standards.

PEP-515 Underscores in Numeric Literals

Using visual separators in numbers helps us comprehend large numbers. PEP-515 has introduced this feature in python.

# separator by thousands
ten_thousand = 10_000.0
hundred_thousand = 100_000.0

The underscores in numeric literals shown above help improve readability.

String formatting also supports underscore syntax.

print("{:_}".format(123456789))
123_456_789

Reference

https://peps.python.org/pep-0515/