close
close

Writing such numbers in Python is a crime | by Liu Zuo Lin | November 2024

Read for free: https://zlliu.medium.com/writing-numbers-like-this-in-python-is-a-crime-722d32e13f98?sk=174f060478bc753bc3a7be73cc0320fd

Have you ever felt? Pooh when you see a large number with many digits?

I definitely do – especially when I have to manually count the number of zeros to figure out if a number is 100,000, 1 million, 100 million, 1 billion, etc.

CONSTANT1 = 100000
CONSTANT2 = 1000000
CONSTANT3 = 100000000
CONSTANT4 = 1000000000
CONSTANT5 = 100000000000
CONSTANT6 = 10000000000000

Can't you just suck it up and count the number of digits, bruh??

The audacity of this generation, too lazy to even simply count

  • The number is not immediately apparent and is therefore less readable
  • It's not unreadable – it's less readable than it could be optimally
  • It is annoying I have to manually count the number of digits, so much so that I usually don't bother with it at all
  • Code should be as readable as possible, and this is far from it.