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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file touketsu-0.1.1.tar.gz.

File metadata

  • Download URL: touketsu-0.1.1.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.6

File hashes

Hashes for touketsu-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ec9447f7e797036e57bd894013e57878b2dea75fb8772c951f018ef331b9ff57
MD5 d9f4a1e2f82d442d45a034965890c29f
BLAKE2b-256 df8a73666fc223d94bf0f63e79d54f92c28cb51d5bd277698f29e03cc88bb4c5

See more details on using hashes here.

File details

Details for the file touketsu-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: touketsu-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.6

File hashes

Hashes for touketsu-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3ea36c838b452e7ef454ded3ab352cf256b8646ce55e15d8e96099635d94c5c8
MD5 d50f75ad6dd5741207ea79abd7f172af
BLAKE2b-256 5be3aeb66bb36c3bd96f7f6e7658b25a44008554acfeb629935d24d37fea59ac

See more details on using hashes here.

Supported by

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