Skip to main content

Overview

Use the class Protected as a parent.

Installation

To install protectedclasses, you can use pip. Open your terminal and run:

pip install protectedclasses

Implementation

class Protected:
    def __setattr__(self, name, value):
        cls = type(self)
        if name.startswith("_"):
            super().__setattr__(name, value)
            return
        if isinstance(getattr(cls, name, None), property):
            super().__setattr__(name, value)
            return
        e = "%r object has no property %r"
        e %= (cls.__name__, name)
        raise AttributeError(e)

License

This project is licensed under the MIT License.

Credits

Thank you for using protectedclasses!

Metadata

Release files for protectedclasses 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for protectedclasses 1.0.0
File Size Uploaded
protectedclasses-1.0.0.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for protectedclasses 1.0.0
File Interpreter ABI Platform
protectedclasses-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.9 kB

Release files / protectedclasses-1.0.0.tar.gz

Download URL protectedclasses-1.0.0.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
092288b1f5c394f6395e03117eefdd6a557ffeeb20e8578c39151460a32eaf58
BLAKE2b-256 checksum
How to use checksums
e12d333aabb60467f7adab852c9cc9273a7c7f472dca299541cb867d178c049e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / protectedclasses-1.0.0-py3-none-any.whl

Download URL protectedclasses-1.0.0-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c66a780a41a8a21c38c899197ff31136d7ba65e7fbe862677e49e493d7dd48f6
BLAKE2b-256 checksum
How to use checksums
35ba88275ee5e84776b92a8cf24de1e41e5707e6ed30c0c8da1a6f8166007d3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page