A lightweight Python package for creating constant-style values that cannot be reassigned or deleted.
Python does not have a built-in const keyword like JavaScript. pyconstlock gives you a simple protected object for constant values.
pip install pyconstlock
Usage
from pyconstlock import Const
const = Const()
const.API_KEY = "abc123"
const.MAX_USERS = 50
const.APP_NAME = "My App"
print(const.API_KEY)
print(const.MAX_USERS)
print(const.APP_NAME)
const.MAX_USERS = 100 # error
Features
-Prevent reassignment
-Prevent deletion
-Enforce uppercase naming