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
Metadata
Release files for clsprop 1.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| clsprop-1.5.0.tar.gz | 19.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| clsprop-1.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.2 kB
Release files / clsprop-1.5.0.tar.gz
| Download URL | clsprop-1.5.0.tar.gz |
|---|---|
| Size | 19.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7b8aa165c0d1424c1a05c653ac22b3566752de18e483f9f3f6c1add1b13b7d56
|
|
BLAKE2b-256 checksum How to use checksums |
987902e8f28002f10562208bf66710810c589b24ce00137efc9d2e3efe6c36fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Release files / clsprop-1.5.0-py3-none-any.whl
| Download URL | clsprop-1.5.0-py3-none-any.whl |
|---|---|
| Size | 2.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ea5b52bfff6a57f79adf58ee1de53ede2d6ea3521c34b07a9e23c3e8aef6b21f
|
|
BLAKE2b-256 checksum How to use checksums |
d73f6fc27d8b367437fc715a28bd2b21e1cef7fe827a5ca612e7cd78d0cf2191
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|