Open this example in the interactive library
Source code
from functools import cached_property
class Report:
@cached_property
def title(self):
print('Computed')
return 'Summary'
report = Report()
print(report.title, report.title)Sample output
Computed Summary Summary
