summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-10-18 07:21:05 (GMT)
committerGitHub <noreply@github.com>2019-10-18 07:21:05 (GMT)
commit380d443a6ac73cb4719d86fd5781544630bcec5e (patch)
tree7fe9beb88cfc8f74632391cadfac4a345f90e205 /Doc/whatsnew
parentc615db608dbb36a5d10188f7d265dcec7bfcc3cf (diff)
downloadcpython-380d443a6ac73cb4719d86fd5781544630bcec5e.zip
cpython-380d443a6ac73cb4719d86fd5781544630bcec5e.tar.gz
cpython-380d443a6ac73cb4719d86fd5781544630bcec5e.tar.bz2
Doc: Add missing entry for functools.cached_property (GH-16803)
(cherry picked from commit 93b81e1fcbeb61c1b49ac2fa52c5a0dff929940b) Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r--Doc/whatsnew/3.8.rst16
1 files changed, 16 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
index e1388e2..ef4209f 100644
--- a/Doc/whatsnew/3.8.rst
+++ b/Doc/whatsnew/3.8.rst
@@ -685,6 +685,22 @@ than as a function returning a decorator. So both of these are now supported::
(Contributed by Raymond Hettinger in :issue:`36772`.)
+Added a new :func:`functools.cached_property` decorator, for computed properties
+cached for the life of the instance. ::
+
+ import functools
+ import statistics
+
+ class Dataset:
+ def __init__(self, sequence_of_numbers):
+ self.data = sequence_of_numbers
+
+ @functools.cached_property
+ def variance(self):
+ return statistics.variance(self.data)
+
+(Contributed by Carl Meyer in :issue:`21145`)
+
gc
--