Python Enum: Stop using magical numbers in your Python code, try to use Enum like a pro

Learn to use Enum to make your code cleaner and more readable

When I read the Python code of some people, I can often see some hardcoded magical numbers. For example, some may hard code the user status to 1 or 0 depending on whether the user is active or not. However, these magical numbers are difficult to read and update.

--

--

I’m a Software Developer (https://www.superdataminer.com) keen on sharing thoughts, tutorials, and solutions for the best practice of software development.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Lynn Kwong

I’m a Software Developer (https://www.superdataminer.com) keen on sharing thoughts, tutorials, and solutions for the best practice of software development.