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
File details
Details for the file read_only_class_attributes-1.0.1.tar.gz
.
File metadata
- Download URL: read_only_class_attributes-1.0.1.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dce2d82f0fb2977f8fe5aca24681ce77f0cbdb449f1a086f9e6b9144d8bcd354 |
|
MD5 | ed12a92d7192e4553247a1ad40b6ca96 |
|
BLAKE2b-256 | a85cd33e9467d9771de944d59a5d0773f9182f2eccde69fd9736a50b0ff859e4 |
File details
Details for the file read_only_class_attributes-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: read_only_class_attributes-1.0.1-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80f8cebfc3d56ffe1bff0b1a51b2c04b7c38e2ba62a1c5f57790448c17036948 |
|
MD5 | 12a32baa8605b7410e31a615ec278f11 |
|
BLAKE2b-256 | a0b9740d8c94b349718850bd022397ac032fc459b4dd458b456eec035e9ca30a |