[Python-Dev] caching in the stdlib? (was: New regex module for 3.2?)

Guido van Rossum guido at python.org
Wed Jul 28 16:31:10 CEST 2010


On Tue, Jul 27, 2010 at 10:29 PM, Stefan Behnel <stefan_ml at behnel.de> wrote:
> What about actually putting it visibly into the stdlib? Except for files, I
> didn't see much about caching there, which seems like a missing battery to
> me. Why not do it as with the collections module and add stuff as it comes
> in?

Caching is a rather large topic to focus on in a single stdlib module
or package. It means radically different things to different people.

The pattern we're talking about there is probably more something like
memoization, so 'memo' or 'memoization' could b a reasonable module
name. Maybe it could provide a decorator that you configure with
things like how many entries max, the expiration policy (or different
policies could have different decorators), and how to compute the memo
key from the arguments to the function (the default could be the
repr() of the argument tuple).

-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-Dev mailing list