Is anyone else interested in additional introspection facilities for the 
functools.lru_cache?

You can view the cache hit and miss statistics using the cache_info() 
method, but you can't see what values actually are in the cache. That 
would be useful to me.

I propose a method:

    @functools.lru_cache()
    def function(arg):
        ...

    function.cache_export()

that returns a dictionary {arg: value} representing the cache. It 
wouldn't be the cache itself, just a shallow copy of the cache data.

Any interest?


-- 
Steve
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/R5L57XH2A2DCC5HEJSDE6VVOBIZW6JUG/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to