summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-11-07 05:58:11 (GMT)
committerRaymond Hettinger <rhettinger@users.noreply.github.com>2019-11-07 05:58:11 (GMT)
commit6b66dc387935df432cdbc01397ddef534a84ade9 (patch)
treec65f13e984bb8b87d43134b6f1a7694d21cdecd8 /Doc
parent30da387df193b9f05c2891ae601ae5a1d669a5c1 (diff)
downloadcpython-6b66dc387935df432cdbc01397ddef534a84ade9.zip
cpython-6b66dc387935df432cdbc01397ddef534a84ade9.tar.gz
cpython-6b66dc387935df432cdbc01397ddef534a84ade9.tar.bz2
bpo-38382: Document the early-out behavior for a zero (GH-17037) (GH-17078)
(cherry picked from commit 7f460494d2309ace004a400bae8fc59134dc325c) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/statistics.rst7
1 files changed, 6 insertions, 1 deletions
diff --git a/Doc/library/statistics.rst b/Doc/library/statistics.rst
index a702b24..00c0b53 100644
--- a/Doc/library/statistics.rst
+++ b/Doc/library/statistics.rst
@@ -164,7 +164,8 @@ However, for reading convenience, most of the examples show sorted sequences.
The harmonic mean, sometimes called the subcontrary mean, is the
reciprocal of the arithmetic :func:`mean` of the reciprocals of the
data. For example, the harmonic mean of three values *a*, *b* and *c*
- will be equivalent to ``3/(1/a + 1/b + 1/c)``.
+ will be equivalent to ``3/(1/a + 1/b + 1/c)``. If one of the values
+ is zero, the result will be zero.
The harmonic mean is a type of average, a measure of the central
location of the data. It is often appropriate when averaging
@@ -190,6 +191,10 @@ However, for reading convenience, most of the examples show sorted sequences.
:exc:`StatisticsError` is raised if *data* is empty, or any element
is less than zero.
+ The current algorithm has an early-out when it encounters a zero
+ in the input. This means that the subsequent inputs are not tested
+ for validity. (This behavior may change in the future.)
+
.. versionadded:: 3.6