Skip to main content

cachedprop

Python 3.6 Python 3.7 Build Status

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.

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)

Uploaded Source

Built Distribution

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

cachedprop-0.1.0-py3-none-any.whl (2.0 kB view details)

Uploaded Python 3

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

Hashes for cachedprop-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ae50077b1fa204e9932d76a9284d800859225d0177edb8312c5dd5ef09863eb1
MD5 0074580caa3dee7097519e0af5467a6b
BLAKE2b-256 71bb5f0f6884a8ee716d72ad4f5f78dd808b29e3394c8c557c49167105d0e09b

See more details on using hashes here.

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

Hashes for cachedprop-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7827459f269b7c8d649c9c88441b452fabc32cdb2747aed500394b22a74a5fae
MD5 a62bb0e3eb359da26f7ae4c1c2490786
BLAKE2b-256 15e2dece11e6b4f37c99cf85407b1531e8b64d3072e4a70ce04fe952e65a8cb7

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page