diff options
author | Stéphane Wirtel <stephane@wirtel.be> | 2019-10-18 07:14:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-18 07:14:18 (GMT) |
commit | 93b81e1fcbeb61c1b49ac2fa52c5a0dff929940b (patch) | |
tree | 73b4935873c6f99323d1849164425a41e5d0c334 /Doc | |
parent | f33c57d5c780da1500619f548585792bb5b750ee (diff) | |
download | cpython-93b81e1fcbeb61c1b49ac2fa52c5a0dff929940b.zip cpython-93b81e1fcbeb61c1b49ac2fa52c5a0dff929940b.tar.gz cpython-93b81e1fcbeb61c1b49ac2fa52c5a0dff929940b.tar.bz2 |
Doc: Add missing entry for functools.cached_property (GH-16803)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/whatsnew/3.8.rst | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst index 85351e1..fef712d 100644 --- a/Doc/whatsnew/3.8.rst +++ b/Doc/whatsnew/3.8.rst @@ -683,6 +683,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 -- |