Skip to content

austinewoody/pyconstlock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pyconstlock

PyPI Python License Downloads Last Commit Stars

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.

📦 Installation

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

About

A lightweight Python package for creating constant-style values that cannot be reassigned or deleted.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages