[Python-checkins] (no subject)

Stéphane Wirtel webhook-mailer at python.org
Fri Oct 18 03:14:45 EDT 2019




To: python-checkins at python.org
Subject: Doc: Add missing entry for functools.cached_property (GH-16803)
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

https://github.com/python/cpython/commit/93b81e1fcbeb61c1b49ac2fa52c5a0dff929=
940b
commit: 93b81e1fcbeb61c1b49ac2fa52c5a0dff929940b
branch: master
author: St=C3=A9phane Wirtel <stephane at wirtel.be>
committer: GitHub <noreply at github.com>
date: 2019-10-18T09:14:18+02:00
summary:

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

files:
M Doc/whatsnew/3.8.rst

diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
index 85351e10e6994..fef712d2ab296 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 th=
ese are now supported::
=20
 (Contributed by Raymond Hettinger in :issue:`36772`.)
=20
+Added a new :func:`functools.cached_property` decorator, for computed proper=
ties
+cached for the life of the instance. ::
+
+   import functools
+   import statistics
+
+   class Dataset:
+      def __init__(self, sequence_of_numbers):
+         self.data =3D sequence_of_numbers
+
+      @functools.cached_property
+      def variance(self):
+         return statistics.variance(self.data)
+
+(Contributed by Carl Meyer in :issue:`21145`)
+
=20
 gc
 --



More information about the Python-checkins mailing list