def cached_property(func):
    '''A cached property. 

    The original function will be evaluated only once, then
    the cached result will be returned on subsequent calls

    Example:

    class Foo(object):
        @cached_property
        def message(self):
            result = <some heavyweight calculation>
            return result
    '''
    attr_name = '__cached__' + func.__name__
    @property
    def _cached_property(self):
        try:
            return getattr(self, attr_name)
        except __HOLE__:
            setattr(self, attr_name, func(self))
            return getattr(self, attr_name)
    return _cached_property
dataset/ETHPy150Open boakley/robotframework-workbench/rwb/lib/decorators.py/cached_property