This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients asvetlov, rhettinger, serhiy.storchaka, uranusjr, yselivanov
Date 2022-02-23.16:39:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I think that 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:

def reawaitable(func):
    def wrapper(*args, **kwargs):
        return CachedAwaitable(func(*args, **kwargs))
    return wrapper

It can be combined with lru_cache and cached_property any third-party caching decorator. No access to internals of the cache is needed.

async def coro(...):

async def prop(self):
Date User Action Args
2022-02-23 16:39:43serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, asvetlov, yselivanov, uranusjr
2022-02-23 16:39:43serhiy.storchakasetmessageid: <>
2022-02-23 16:39:43serhiy.storchakalinkissue46622 messages
2022-02-23 16:39:42serhiy.storchakacreate