efficient memoize decorator?
Gabriel Genellina
gagsl-p32 at yahoo.com.ar
Sat Aug 19 08:23:59 EDT 2006
At Saturday 19/8/2006 07:56, thattommyhallll at gmail.com wrote:
>does not seem to work for standalone functions, this is a method
>decorator only then?
>
>Traceback (most recent call last):
> File "prob14memoize.py", line 94, in ?
> length = col(i,1)
> File "prob14memoize.py", line 49, in __call__
> object = self.cache[args] = self.fn(self.instance, *args)
>AttributeError: 'Memoize' object has no attribute 'instance'
For a standalone function, you should remove __del__ and
self.instance, but I haven't tried it...
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