How to memoize functions?

sismex01 at sismex01 at
Fri Jun 27 16:56:32 CEST 2003

> From: Chris Reedy [mailto:creedy at] 
> Sent: Viernes, 27 de Junio de 2003 09:19 a.m.
> That's true. Unfortunately, that misses the other half of the
> problem (which, admittedly, I didn't mention) which is that I
> would also like to be able to collect the results of the function,
> which could be complex data structures, as well as the arguments
> (which could be other instances of the same complex structures).
>    Chris

So how do you wish to memoize, if you wish for the
results (which are gonna get cached) to be collected?

Is this a long running process?  If it's not, then
I'd say to cache the results which take more than X
seconds to calculate and forget about having the
results collected.

Or, use a shelf instead of a dictionary.


Advertencia:La informacion contenida en este mensaje es confidencial y
restringida, por lo tanto esta destinada unicamente para el uso de la
persona arriba indicada, se le notifica que esta prohibida la difusion de
este mensaje. Si ha recibido este mensaje por error, o si hay problemas en
la transmision, favor de comunicarse con el remitente. Gracias.

More information about the Python-list mailing list