Skip to main content

A package for creating classes that disallow dynamic attribute creation.

Project description

https://raw.githubusercontent.com/phetdam/touketsu/master/doc/source/_static/touketsu_logo_small.png PyPI version Travis (.org) Documentation Status

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

touketsu-0.1.1.tar.gz (6.4 kB view hashes)

Uploaded Source

Built Distribution

touketsu-0.1.1-py3-none-any.whl (7.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page