Commit 93b81e1f authored by Stéphane Wirtel's avatar Stéphane Wirtel Committed by GitHub

Doc: Add missing entry for functools.cached_property (GH-16803)

parent f33c57d5
...@@ -683,6 +683,22 @@ than as a function returning a decorator. So both of these are now supported:: ...@@ -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`.) (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 gc
-- --
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment