Message413923
[Andrew Svetlov]
> A third-party library should either copy all these
> implementation details or import a private function from stdlib
OrderedDict provides just about everything needed to roll lru cache variants. It simply isn't true this can only be done efficiently in the standard library.
[Serhiy]
> it would be simpler to add a decorator which wraps the result
> of an asynchronous function into an object which can be awaited
> more than once:
This is much more sensible.
> It can be combined with lru_cache and cached_property any third-party
> caching decorator. No access to internals of the cache is needed.
Right. The premise that this can only be done in the standard library was false.
> async_lru_cache() and async_cached_property() can be written
> using that decorator.
The task becomes trivially easy :-)
[Andrew Svetlov]
> Pull Request is welcome!
ISTM it was premature to ask for a PR before an idea has been thought through. We risk wasting a user's time or committing too early before simpler, better designed alternatives emerge. |
|
Date |
User |
Action |
Args |
2022-02-24 16:03:50 | rhettinger | set | recipients:
+ rhettinger, asvetlov, serhiy.storchaka, yselivanov, uranusjr, achimnol |
2022-02-24 16:03:50 | rhettinger | set | messageid: <1645718630.48.0.579466948362.issue46622@roundup.psfhosted.org> |
2022-02-24 16:03:50 | rhettinger | link | issue46622 messages |
2022-02-24 16:03:50 | rhettinger | create | |
|