Re: Add decorator django.utils.functional.cached_classproperty

2020-12-30 Thread Adam Johnson
There's no need for such a decorator - a class-level cached property can already be achieved with @classproperty and @lru_cache: In [1]: from functools import lru_cache In [2]: from django.utils.functional import classproperty In [3]: class Thing: ...: @classproperty ...: @lru_cach

Re: Add decorator django.utils.functional.cached_classproperty

2020-12-30 Thread Tom Forbes
I’m slightly skeptical - a cached class property seems slightly iffy and could be achieved with just a @functools.cache’d classmethod instead? Is there a specific use case where a cached, class _property_ would be the best way? And perhaps we need to care about concurrent access here, more than