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
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):
> >>
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):
>>
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
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)