[Python-checkins] bpo-38385: Fix iterator/iterable terminology in statistics docs (GH-17111)

Raymond Hettinger webhook-mailer at python.org
Tue Nov 12 02:35:10 EST 2019


https://github.com/python/cpython/commit/733b9a308e3c49855888e2e12397ae56d831e780
commit: 733b9a308e3c49855888e2e12397ae56d831e780
branch: master
author: Raymond Hettinger <rhettinger at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-11-11T23:35:06-08:00
summary:

bpo-38385: Fix iterator/iterable terminology in statistics docs (GH-17111)

files:
M Doc/library/statistics.rst
M Lib/statistics.py

diff --git a/Doc/library/statistics.rst b/Doc/library/statistics.rst
index 00c0b539edce9..a790ed81a5607 100644
--- a/Doc/library/statistics.rst
+++ b/Doc/library/statistics.rst
@@ -77,7 +77,7 @@ However, for reading convenience, most of the examples show sorted sequences.
 
 .. function:: mean(data)
 
-   Return the sample arithmetic mean of *data* which can be a sequence or iterator.
+   Return the sample arithmetic mean of *data* which can be a sequence or iterable.
 
    The arithmetic mean is the sum of the data divided by the number of data
    points.  It is commonly called "the average", although it is only one of many
@@ -122,7 +122,7 @@ However, for reading convenience, most of the examples show sorted sequences.
    Convert *data* to floats and compute the arithmetic mean.
 
    This runs faster than the :func:`mean` function and it always returns a
-   :class:`float`.  The *data* may be a sequence or iterator.  If the input
+   :class:`float`.  The *data* may be a sequence or iterable.  If the input
    dataset is empty, raises a :exc:`StatisticsError`.
 
    .. doctest::
@@ -143,7 +143,7 @@ However, for reading convenience, most of the examples show sorted sequences.
 
    Raises a :exc:`StatisticsError` if the input dataset is empty,
    if it contains a zero, or if it contains a negative value.
-   The *data* may be a sequence or iterator.
+   The *data* may be a sequence or iterable.
 
    No special efforts are made to achieve exact results.
    (However, this may change in the future.)
@@ -158,7 +158,7 @@ However, for reading convenience, most of the examples show sorted sequences.
 
 .. function:: harmonic_mean(data)
 
-   Return the harmonic mean of *data*, a sequence or iterator of
+   Return the harmonic mean of *data*, a sequence or iterable of
    real-valued numbers.
 
    The harmonic mean, sometimes called the subcontrary mean, is the
@@ -202,7 +202,7 @@ However, for reading convenience, most of the examples show sorted sequences.
 
    Return the median (middle value) of numeric data, using the common "mean of
    middle two" method.  If *data* is empty, :exc:`StatisticsError` is raised.
-   *data* can be a sequence or iterator.
+   *data* can be a sequence or iterable.
 
    The median is a robust measure of central location and is less affected by
    the presence of outliers.  When the number of data points is odd, the
@@ -231,7 +231,7 @@ However, for reading convenience, most of the examples show sorted sequences.
 .. function:: median_low(data)
 
    Return the low median of numeric data.  If *data* is empty,
-   :exc:`StatisticsError` is raised.  *data* can be a sequence or iterator.
+   :exc:`StatisticsError` is raised.  *data* can be a sequence or iterable.
 
    The low median is always a member of the data set.  When the number of data
    points is odd, the middle value is returned.  When it is even, the smaller of
@@ -251,7 +251,7 @@ However, for reading convenience, most of the examples show sorted sequences.
 .. function:: median_high(data)
 
    Return the high median of data.  If *data* is empty, :exc:`StatisticsError`
-   is raised.  *data* can be a sequence or iterator.
+   is raised.  *data* can be a sequence or iterable.
 
    The high median is always a member of the data set.  When the number of data
    points is odd, the middle value is returned.  When it is even, the larger of
@@ -272,7 +272,7 @@ However, for reading convenience, most of the examples show sorted sequences.
 
    Return the median of grouped continuous data, calculated as the 50th
    percentile, using interpolation.  If *data* is empty, :exc:`StatisticsError`
-   is raised.  *data* can be a sequence or iterator.
+   is raised.  *data* can be a sequence or iterable.
 
    .. doctest::
 
@@ -381,7 +381,7 @@ However, for reading convenience, most of the examples show sorted sequences.
 
 .. function:: pvariance(data, mu=None)
 
-   Return the population variance of *data*, a non-empty sequence or iterator
+   Return the population variance of *data*, a non-empty sequence or iterable
    of real-valued numbers.  Variance, or second moment about the mean, is a
    measure of the variability (spread or dispersion) of data.  A large
    variance indicates that the data is spread out; a small variance indicates
diff --git a/Lib/statistics.py b/Lib/statistics.py
index 461ffae3f4914..1e95c0b6639f1 100644
--- a/Lib/statistics.py
+++ b/Lib/statistics.py
@@ -744,7 +744,7 @@ def variance(data, xbar=None):
 def pvariance(data, mu=None):
     """Return the population variance of ``data``.
 
-    data should be a sequence or iterator of Real-valued numbers, with at least one
+    data should be a sequence or iterable of Real-valued numbers, with at least one
     value. The optional argument mu, if given, should be the mean of
     the data. If it is missing or None, the mean is automatically calculated.
 



More information about the Python-checkins mailing list