[Python-checkins] bpo-36018: Make "seed" into a keyword only argument (GH-12921)

Raymond Hettinger webhook-mailer at python.org
Tue Apr 23 04:56:26 EDT 2019


https://github.com/python/cpython/commit/fb8c7d53326d137785ca311bfc48c8284da46770
commit: fb8c7d53326d137785ca311bfc48c8284da46770
branch: master
author: Raymond Hettinger <rhettinger at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-04-23T01:46:18-07:00
summary:

bpo-36018: Make "seed" into a keyword only argument (GH-12921)

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

diff --git a/Doc/library/statistics.rst b/Doc/library/statistics.rst
index b62bcfdffd0b..fb7df4e7188a 100644
--- a/Doc/library/statistics.rst
+++ b/Doc/library/statistics.rst
@@ -607,7 +607,7 @@ of applications in statistics.
        :exc:`StatisticsError` because it takes at least one point to estimate
        a central value and at least two points to estimate dispersion.
 
-    .. method:: NormalDist.samples(n, seed=None)
+    .. method:: NormalDist.samples(n, *, seed=None)
 
        Generates *n* random samples for a given mean and standard deviation.
        Returns a :class:`list` of :class:`float` values.
diff --git a/Lib/statistics.py b/Lib/statistics.py
index 4a0978cbcd9c..19db8e828010 100644
--- a/Lib/statistics.py
+++ b/Lib/statistics.py
@@ -797,7 +797,7 @@ def from_samples(cls, data):
         xbar = fmean(data)
         return cls(xbar, stdev(data, xbar))
 
-    def samples(self, n, seed=None):
+    def samples(self, n, *, seed=None):
         'Generate *n* samples for a given mean and standard deviation.'
         gauss = random.gauss if seed is None else random.Random(seed).gauss
         mu, sigma = self.mu, self.sigma



More information about the Python-checkins mailing list