A package for creating classes that disallow dynamic attribute creation.
Project description
touketsu is a tiny package for creating classes that disallow dynamic instance attribute creation or modification while preserving class inheritance. This project was inspired by all the unfortunate incidences where fat-finger errors led to the creation of a new instance attribute instead of the modification of an existing instance attribute.
Installation
On all systems, install the latest version from PyPI with
pip3 install --upgrade touketsu
After installing, check that the package is properly working using the interpreter, for example
>>> from touketsu import immutable >>> @immutable ... class a_class: ... def __init__(self, a = "a"): ... self.a = a >>> aa = a_class()
Attempting to execute aa.a = 5 will result in an AttributeError, as a_class instances are immutable.
Documentation
The documentation for touketsu is hosted on Read the Docs here.
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.