def lazyprop(func):
 attr_name = ('_lazy_' + func.__name__)
 @property
 def _lazyprop(self):
  'A lazily evaluated propery.\n        '
  if (not hasattr(self, attr_name)):
   setattr(self, attr_name, func(self))
  return getattr(self, attr_name)
 return _lazyprop

def lazyprop ( func ) : attr_name = ( '_lazy_' + func . __name__ ) @ property def _lazyprop ( self ) : if ( not hasattr ( self , attr_name ) ) : setattr ( self , attr_name , func ( self ) ) return getattr ( self , attr_name ) return _lazyprop
wraps a property so it is lazily evaluated .