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

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.

--

--

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

Lynn Kwong

440 Followers

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