What
Python 3.8 adds great descriptor to functools: cached_property. Technically all required APIs was available since python 3.6, but it is what it is.
This package is a backport of this functionality for python 3.6 and 3.7.
How to use
from backports.cached_property import cached_property
And then python 3.8 documentation will work (because code is minimally changed):
Transform a method of a class into a property whose value is computed once and then cached as a normal attribute for the life of the instance. Similar to property, with the addition of caching. Useful for expensive computed properties of instances that are otherwise effectively immutable.
Example:
class DataSet:
def __init__(self, sequence_of_numbers):
self._data = sequence_of_numbers
@cached_property
def stdev(self):
return statistics.stdev(self._data)
@cached_property
def variance(self):
return statistics.variance(self._data)
Metadata
Release files for backports.cached-property 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| backports.cached-property-1.0.2.tar.gz | 8.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| backports.cached_property-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.1 kB
Release files / backports.cached-property-1.0.2.tar.gz
| Download URL | backports.cached-property-1.0.2.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9306f9eed6ec55fd156ace6bc1094e2c86fae5fb2bf07b6a9c00745c656e75dd
|
|
BLAKE2b-256 checksum How to use checksums |
08834cea5c665d2af765c02f7d8e8560b5918405c1d7d11ccfc60c4919c1cfd0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|
Release files / backports.cached_property-1.0.2-py3-none-any.whl
| Download URL | backports.cached_property-1.0.2-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
baeb28e1cd619a3c9ab8941431fe34e8490861fb998c6c4590693d50171db0cc
|
|
BLAKE2b-256 checksum How to use checksums |
ebae69e52acdcf381b108b36d989ea58656de4a9ab8863aba6176d80d01041df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|
Security for backports.cached-property 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.