Here’s how I am declaring constants and using them across different Python classes:
# project/constants.py
GOOD = 1
BAD = 2
AWFUL = 3
# project/question.py
from constants import AWFUL, BAD, GOOD
class Question:
def __init__(self):
...
Is the above a good way to store and use contant values? I realise that after a while, the constants file can get pretty big and I could explicitly be importing 10+ of those constants in any given file.
why not just use
From the python zen:
EDIT: Except, when you do quote, you should include a reference and check it, because as others have pointed out, it should read:
This time, I actually copied it from the source: PEP 20 — The Zen of Python