[issue35040] [functools] provide an async-compatible version of functools.lru_cache

2019-05-28 Thread Liran Nuna


Liran Nuna  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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35040] [functools] provide an async-compatible version of functools.lru_cache

2019-05-28 Thread Brett Cannon


Brett Cannon  added the comment:

I was just saying that this is an enhancement request, no judgment about 
whether we want to solve the enhancement request.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35040] [functools] provide an async-compatible version of functools.lru_cache

2019-05-27 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Brett please elaborate.
Do you want to incorporate async_lru library into CPython Core?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35040] [functools] provide an async-compatible version of functools.lru_cache

2018-10-22 Thread Brett Cannon


Brett Cannon  added the comment:

Making this a feature request.

--
nosy: +brett.cannon
title: functools.lru_cache does not work with coroutines -> [functools] provide 
an async-compatible version of functools.lru_cache
type:  -> enhancement
versions:  -Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com