Welcome, guest | Sign In | My Account | Store | Cart
def lazyproperty(func):
    """A decorator for lazy evaluation of properties
    """
    cache = {}
    def _get(self):
        try:
            return cache[self]
        except KeyError:
            cache[self] = value = func(self)
            return value
        
    return property(_get)

History

  • revision 6 (14 years ago)
  • previous revisions are not available