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)
                return val
       return memoized_fn


and I am really clueless, about what it does. I know in general we try
to keep computed values for future usage. But I am having hard-time
visualizing it.
What is obj here? and what does *args means?
Thanks
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to