Skip to content

bpo-38385: Fix iterator/iterable terminology in statistics docs #17111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Doc/library/statistics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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::
Expand All @@ -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.)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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::

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Lib/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down