[Python-ideas] functools.lru_cache manual cache modification

Constantin Berhard constantin at exxxtremesys.lu
Mon Dec 8 01:10:41 CET 2014


On 05.12.2014 20:35, Ethan Furman wrote:
> A couple comments:
> 
> You need better names.  f? _f? fun? which of those two are the same?
You are right. I will fix this.
> Have you tried it without the 'return_from' function?
Sometimes you want to mix tail recursion and non-tail recursion. I see
no way to automatically determine, which one to use (apart from changing
CPython). So I think there must be two different returns, in this case
the normal return and the return_from.
> It might be interesting to have this be a more general 'recurse' decorator.
What would it do?
> You could have your own basic cache, and specify which methods you need for somebody to substitute in a different cache
> (which is a better option for all previous Pythons than making a change to 3.5).
I didn't really intend to write a cache.

@Andrew Barnert: Thank you for the pointers. I will follow them as soon
as I have some time.

Best Regards,
Constantin


More information about the Python-ideas mailing list