From ee1ea849017a24b975f8886e2a72cfa5ef25ecb7 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Tue, 23 Apr 2019 01:25:24 -0700 Subject: [PATCH] bpo-36018: Make "seed" into a keyword only argument --- Doc/library/statistics.rst | 2 +- Lib/statistics.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/statistics.rst b/Doc/library/statistics.rst index b62bcfdffd0b392..fb7df4e7188a077 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 05edfdf98e06a8f..2c60b8807cfbad5 100644 --- a/Lib/statistics.py +++ b/Lib/statistics.py @@ -796,7 +796,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