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.5.0.tar.gz (19.0 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.5.0-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: clsprop-1.5.0.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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.5.0.tar.gz
Algorithm Hash digest
SHA256 7b8aa165c0d1424c1a05c653ac22b3566752de18e483f9f3f6c1add1b13b7d56
MD5 056feb529148d872a9c6e168aaf44d2b
BLAKE2b-256 987902e8f28002f10562208bf66710810c589b24ce00137efc9d2e3efe6c36fe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: clsprop-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 2.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ea5b52bfff6a57f79adf58ee1de53ede2d6ea3521c34b07a9e23c3e8aef6b21f
MD5 a205bae377edd3af829306bcd85c8a2a
BLAKE2b-256 d73f6fc27d8b367437fc715a28bd2b21e1cef7fe827a5ca612e7cd78d0cf2191

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