Liran Nuna <liran...@gmail.com> added the comment:

> A coroutine detection is a relatively slow check.
> I don't think we need to do it in `functools.lru_cache`.

Wouldn't a coroutine check only happen during decoration time? To successfully 
solve this easily and efficiently, we only really need to wrap the coroutine 
with `asyncio.ensure_future` if the decorated function is a coroutine, and it 
will only happen when a result comes back from the decorated function which 
would have minimal impact.

Of course, I don't know much about the internals of `lru_cache` so my 
assumptions could be wrong. I should familiar myself with the implementation 
and figure out how doable it would be.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35040>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to