According to PEP 435 Enum class is
An enumeration is a set of symbolic names bound to unique, constant values.
Within an enumeration, the values can be compared by identity, and the enumeration itself can be iterated over.
Should we store variables from .env, .ini or environmental variables in such a class, or is it overkill?
from enum import Enum
from decouple import config
class Constants(Enum):
username = config('DATABASE_USERNAME')
password = config('DATABASE_PASSWORD')
host = config('DATABASE_HOST')
port = config('DATABASE_HOST', cast=int)
Is the above a good idea in the ,,art of code''? Or maybe the better approach is to call each time config function whenever we need that variable in code?