Re: regarding memoize function

2008-04-03 Thread Gabriel Genellina
En Fri, 04 Apr 2008 02:24:14 -0300, <[EMAIL PROTECTED]> escribió: > On Apr 3, 8:04 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: >> En Thu, 03 Apr 2008 21:21:11 -0300, Dan Bishop <[EMAIL PROTECTED]>   >> escribió: >> > On Apr 3, 6:33 pm, [EMAIL PROTECTED] wrote: >> >> I saw example of memoize

Re: regarding memoize function

2008-04-03 Thread ankitks . mital
On Apr 3, 8:04 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 03 Apr 2008 21:21:11 -0300, Dan Bishop <[EMAIL PROTECTED]>   > escribió: > > > > > > > On Apr 3, 6:33 pm, [EMAIL PROTECTED] wrote: > >> I saw example of memoize function...here is snippet > > >> def memoize(fn, slot): > >>

Re: regarding memoize function

2008-04-03 Thread Gabriel Genellina
En Thu, 03 Apr 2008 21:21:11 -0300, Dan Bishop <[EMAIL PROTECTED]> escribió: > On Apr 3, 6:33 pm, [EMAIL PROTECTED] wrote: >> I saw example of memoize function...here is snippet >> >> def memoize(fn, slot): >>def memoized_fn(obj, *args): >> if hasattr(obj, slot): >>

Re: regarding memoize function

2008-04-03 Thread Dan Bishop
On Apr 3, 6:33 pm, [EMAIL PROTECTED] wrote: > I saw example of memoize function...here is snippet > > def memoize(fn, slot): >def memoized_fn(obj, *args): > if hasattr(obj, slot): > return getattr(obj, slot) > else: > val = fn(obj, *ar

regarding memoize function

2008-04-03 Thread ankitks . mital
I saw example of memoize function...here is snippet def memoize(fn, slot): def memoized_fn(obj, *args): if hasattr(obj, slot): return getattr(obj, slot) else: val = fn(obj, *args) setattr(obj, slot, val)