Code
Hub
Workspaces
Connect
Indexed graphs
Engine
MCP
copy
hub
/
github.com/dabeaz/python-cookbook
/ lazy
Function
lazy
src/8/lazily_computed_attributes/example2.py:4–10 ·
view source on GitHub ↗
(self)
Source
from the content-addressed store, hash-verified
2
name =
'_lazy_'
+ func.__name__
3
@property
4
def
lazy(self):
5
if
hasattr(self, name):
6
return
getattr(self, name)
7
else
:
8
value = func(self)
9
setattr(self, name, value)
10
return
value
11
return
lazy
12
13
if
__name__ ==
'__main__'
:
Callers
nothing calls this directly
Calls
1
func
Function · 0.50
Tested by
no test coverage detected