Memoization in Python

Gabriel Genellina gagsl-py at yahoo.com.ar
Fri Jan 5 06:08:57 EST 2007


At Friday 5/1/2007 06:50, Alec Mihailovs wrote:

>Following Antti Karttunen suggestion, I wrote the following simple decorator
>for creating functions with cache (something like 'option remember' in
>Maple). Just wanted to share it:

Nice. There is already a memoize decorator in the Python wiki: 
http://wiki.python.org/moin/PythonDecoratorLibrary, you can get some 
ideas from there. Using the functools module (2.5) or the decorator 
module by M. Simoniato 
(http://www.phyast.pitt.edu/~micheles/python/documentation.html) you 
can improve it so the decorated function looks more like the original.


-- 
Gabriel Genellina
Softlab SRL 


	

	
		
__________________________________________________ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 




More information about the Python-list mailing list