This package provides a decorator to make read only attributes on a given Python class
Project description
Read only Python Class Attributes
This package provides a decorator to make read only attributes on a given Python class
Install
pip install read_only_class_attributes
Usage
from read_only_class_attributed import read_only
#example for all read only attributes
@read_only('*')
class _CONSTANTS:
pi = 3.14159
G = 6.67430e-11
CONSTANTS = _CONSTANTS()
#example for some read only attributes
@read_only('pi', 'G')
class _PLANETCONSTANTS:
pi = 3.14159
G = 6.67430e-11
g = 9.18 #can change
planet = 'Earth' #can change
PLANETCONSTANTS = _PLANETCONSTANTS()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for read_only_class_attributes-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | dce2d82f0fb2977f8fe5aca24681ce77f0cbdb449f1a086f9e6b9144d8bcd354 |
|
MD5 | ed12a92d7192e4553247a1ad40b6ca96 |
|
BLAKE2b-256 | a85cd33e9467d9771de944d59a5d0773f9182f2eccde69fd9736a50b0ff859e4 |
Close
Hashes for read_only_class_attributes-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80f8cebfc3d56ffe1bff0b1a51b2c04b7c38e2ba62a1c5f57790448c17036948 |
|
MD5 | 12a32baa8605b7410e31a615ec278f11 |
|
BLAKE2b-256 | a0b9740d8c94b349718850bd022397ac032fc459b4dd458b456eec035e9ca30a |