cached property method decorator
Project description
cachedprop
cached property method decorator
Demo
from cachedprop import cpd
class LabRat:
def __init__(self) -> None:
self._hp = None
def expensive_hp_getter(self) -> int:
...
@cpd
def hp(self):
return self.expensive_hp_getter()
rat = LabRat()
print(rat.hp) # expensive_hp_getter is called, value gets "cached", prints value
print(rat.hp) # prints "cached" value only.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cachedprop-0.1.0.tar.gz
(1.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cachedprop-0.1.0.tar.gz.
File metadata
- Download URL: cachedprop-0.1.0.tar.gz
- Upload date:
- Size: 1.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.11 CPython/3.6.3 Linux/4.15.0-44-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae50077b1fa204e9932d76a9284d800859225d0177edb8312c5dd5ef09863eb1
|
|
| MD5 |
0074580caa3dee7097519e0af5467a6b
|
|
| BLAKE2b-256 |
71bb5f0f6884a8ee716d72ad4f5f78dd808b29e3394c8c557c49167105d0e09b
|
File details
Details for the file cachedprop-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cachedprop-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.11 CPython/3.6.3 Linux/4.15.0-44-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7827459f269b7c8d649c9c88441b452fabc32cdb2747aed500394b22a74a5fae
|
|
| MD5 |
a62bb0e3eb359da26f7ae4c1c2490786
|
|
| BLAKE2b-256 |
15e2dece11e6b4f37c99cf85407b1531e8b64d3072e4a70ce04fe952e65a8cb7
|