Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:
Note that there is a similar issue with cached generators. >>> from functools import * >>> @lru_cache() ... def g(): ... yield 1 ... >>> list(g()) [1] >>> list(g()) [] I am not sure that it is safe to detect awaitables and iterables in caching decorators and automatically wrap them in re-awaitable and re-iterable objects. But we can add explicit decorators and combine them with arbitrary caching decorators. For example: @lru_cache() @reiterable def g(): yield 1 ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46622> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com