On Sun, Apr 26, 2020 at 1:54 PM Tom Forbes <tom@tomforb.es> wrote:
This is a good idea but some cases need to be lazily evaluated. Without that property `once()` loses a lot of utility. In the case of Django some of the decorated functions create objects that cannot beĀ instantiated until the Django settings have been loaded, which rules out calling them from the module scope.

I believe this use case of lazily initialising objects that cannot be created in the module scope is encountered by other projects. One example off the top of my head might be a database connection, or some other stateful client, that you want a single instance of but want to actually create at some point in the future.

I'm surprised no one mentionedĀ  cached_property (https://docs.python.org/dev/library/functools.html#functools.cached_property)!?