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 f33c57d commit 93b81e1Copy full SHA for 93b81e1
Doc/whatsnew/3.8.rst
@@ -683,6 +683,22 @@ than as a function returning a decorator. So both of these are now supported::
683
684
(Contributed by Raymond Hettinger in :issue:`36772`.)
685
686
+Added a new :func:`functools.cached_property` decorator, for computed properties
687
+cached for the life of the instance. ::
688
+
689
+ import functools
690
+ import statistics
691
692
+ class Dataset:
693
+ def __init__(self, sequence_of_numbers):
694
+ self.data = sequence_of_numbers
695
696
+ @functools.cached_property
697
+ def variance(self):
698
+ return statistics.variance(self.data)
699
700
+(Contributed by Carl Meyer in :issue:`21145`)
701
702
703
gc
704
--
0 commit comments