We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c615db6 commit 380d443Copy full SHA for 380d443
Doc/whatsnew/3.8.rst
@@ -685,6 +685,22 @@ than as a function returning a decorator. So both of these are now supported::
685
686
(Contributed by Raymond Hettinger in :issue:`36772`.)
687
688
+Added a new :func:`functools.cached_property` decorator, for computed properties
689
+cached for the life of the instance. ::
690
+
691
+ import functools
692
+ import statistics
693
694
+ class Dataset:
695
+ def __init__(self, sequence_of_numbers):
696
+ self.data = sequence_of_numbers
697
698
+ @functools.cached_property
699
+ def variance(self):
700
+ return statistics.variance(self.data)
701
702
+(Contributed by Carl Meyer in :issue:`21145`)
703
704
705
gc
706
--
0 commit comments