[Python-ideas] functools.lru_cache manual cache modification

Antoine Pitrou solipsis at pitrou.net
Tue Dec 2 18:50:26 CET 2014


On Tue, 2 Dec 2014 09:39:17 -0800
Guido van Rossum <guido at python.org> wrote:
> 
> But, oddly enough, functools.lru_cache doesn't use collections.OrderedDict
> -- it uses its own linked list, which strikes me as slow. Or what am I
> missing?

collections.OrderedDict uses its own slow linked list.
I suppose lru_cache is micro-optimized; also, it's thread-safe.

Regards

Antoine.




More information about the Python-ideas mailing list