computed-cached-property-0.0.3


توضیحات

A decorator for caching computed properties in classes. like Vue's Computed-Properties
ویژگی مقدار
سیستم عامل OS Independent
نام فایل computed-cached-property-0.0.3
نام computed-cached-property
نسخه کتابخانه 0.0.3
نگهدارنده []
ایمیل نگهدارنده []
نویسنده Li Songe
ایمیل نویسنده i@songe.li
آدرس صفحه اصلی https://github.com/lisonge/computed-cached-property
آدرس اینترنتی https://pypi.org/project/computed-cached-property/
مجوز MIT
<!-- * @Date: 2020-06-19 22:44:45 * @LastEditors: code * @Author: code * @LastEditTime: 2020-06-23 21:58:40 --> # computed-cached-property A decorator for caching computed properties in classes. like Vue's Computed-Properties ## install ```powershell pip install computed-cached-property ``` ## example ```python from computed_cached_property import computed_cached_property from dataclasses import dataclass @dataclass class A: v1: int = 1 v2: str = 'fuck' v3: bool = False @property @computed_cached_property def v4(self): print('run code in v4 function') return f'v1:{self.v1}, v2:{self.v2}, v3:{self.v3}' @property @computed_cached_property(typed=Ture) # same as @functools.lru_cache(maxsize=1, typed=Ture) def v5(self): print('run code in v4 function') return f'v1:{self.v1}, v2:{self.v2}, v3:{self.v3}' a1 = A(v1=99) print(a1.v4) print(a1.v4) a1.v2 = 'xxoo' print(a1.v4) # output # run code in v4 function # v1:99, v2:fuck, v3:False # v1:99, v2:fuck, v3:False # run code in v4 function # v1:99, v2:xxoo, v3:False ``` ## Hint Not recommended for use in a production environment ## License MIT


زبان مورد نیاز

مقدار نام
>=3.6 Python


نحوه نصب


نصب پکیج whl computed-cached-property-0.0.3:

    pip install computed-cached-property-0.0.3.whl


نصب پکیج tar.gz computed-cached-property-0.0.3:

    pip install computed-cached-property-0.0.3.tar.gz