fn.py icon indicating copy to clipboard operation
fn.py copied to clipboard

Required `memoise` function

Open signalpillar opened this issue 12 years ago • 6 comments

I haven't found memoise function implementation. I suggest to have at least two implementations with weakref and regular dictionary.

signalpillar avatar Oct 02 '13 07:10 signalpillar

Does "I suggest" mean that you are not going to implement it as PR?

kachayev avatar Oct 02 '13 21:10 kachayev

Hm, I will try to make my version and then PR. Thanks

signalpillar avatar Oct 03 '13 05:10 signalpillar

Just one question, if you are going to start implementation, how will it differ from http://docs.python.org/3.4/library/functools.html#functools.lru_cache ?

kachayev avatar Oct 03 '13 19:10 kachayev

thank you for pointing me this function. it appears in 3.2 only, while we need something similar in 2.7. also I think there must be something built on top of weakrefs. Btw, the signature of function is very interesting, I even haven't thought about maxsize and typed

signalpillar avatar Oct 03 '13 19:10 signalpillar

Ok, looking forward!

kachayev avatar Oct 03 '13 19:10 kachayev

I have found that there is backport http://code.activestate.com/recipes/578078-py26-and-py30-backport-of-python-33s-lru-cache/ of 3.2 implementation. What do you think about it ?

signalpillar avatar Oct 03 '13 20:10 signalpillar