lazy icon indicating copy to clipboard operation
lazy copied to clipboard

duplication of functools.lru_cache?

Open torstenrudolf opened this issue 5 years ago • 2 comments

this looks like what the builtin functools.lru_cache does

torstenrudolf avatar Mar 17 '20 04:03 torstenrudolf

Lazy is not a cache, it is about lazily creating attributes. I regret giving the caching example. ;-)

What lazy does is replace the descriptor with the returned value in the class dict. I have seen this mechanism being called "reification" in other places.

stefanholek avatar Jun 11 '20 15:06 stefanholek

python3.8 added https://docs.python.org/3/library/functools.html#functools.cached_property which does the same. Thanks for creating this package years ago!

joernheissler avatar Jun 23 '21 15:06 joernheissler

Yep, cached_property is very similar. It has an additional lock though (at least until Python 2.13 when the lock will go away).

stefanholek avatar Sep 15 '23 13:09 stefanholek