Skip to main content

🏫 Just like @property but for classes 🏫

Project description

Works just like @property for classes, except deleters don't work (and are perhaps impossible).

Inspired by https://stackoverflow.com/a/39542816/43839

Example

import clsprop

class Full:
    _name = 'fool'

    @clsprop
    def name(cls):
        return cls._name

    @name.setter
    def name(cls, name):
        cls._name = name

    # Unfortunately, the deleter never gets called
    @name.deleter
    def name(cls, name):
        raise ValueError('Cannot delete name')

assert Full.name == 'fool'

Full.name = 'foll'
assert Full.name == 'foll'

del Full.name  # oh, well

API Documentation

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

clsprop-1.4.0.tar.gz (1.5 kB view details)

Uploaded Source

Built Distribution

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

clsprop-1.4.0-py3-none-any.whl (2.4 kB view details)

Uploaded Python 3

File details

Details for the file clsprop-1.4.0.tar.gz.

File metadata

  • Download URL: clsprop-1.4.0.tar.gz
  • Upload date:
  • Size: 1.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for clsprop-1.4.0.tar.gz
Algorithm Hash digest
SHA256 191fa1680dd8da1db3c50b47de99e99adda00fad1e49c5e49aaccc104de56d21
MD5 49954007f315b3903b156fc2cd396202
BLAKE2b-256 52ceba5250a45bf17a8b73262f5cad94fa03c2b5126dd311f0b3c09d347f4672

See more details on using hashes here.

File details

Details for the file clsprop-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: clsprop-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 2.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for clsprop-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e78ed6967177984449fb399dfd7b7e05cc9fa7aa5800e50e4bf7a31ad021fbcf
MD5 2045f7c9caf00d8594f4215bed560ed6
BLAKE2b-256 d13c91eb247efd9de18b58badc2e0e377405291afd248e67a7b8477730a1c0e2

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