[Python-checkins] bpo-36546: Mark first argument as position only (GH-14363)

Raymond Hettinger webhook-mailer at python.org
Mon Jun 24 22:39:26 EDT 2019


https://github.com/python/cpython/commit/1791128677e71f3b93cae4bbed66ac3c6e4b5110
commit: 1791128677e71f3b93cae4bbed66ac3c6e4b5110
branch: master
author: Raymond Hettinger <rhettinger at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-06-25T04:39:22+02:00
summary:

 bpo-36546: Mark first argument as position only (GH-14363)

files:
A Misc/NEWS.d/next/Library/2019-06-25-05-07-48.bpo-36546.RUcxaK.rst
M Lib/statistics.py

diff --git a/Lib/statistics.py b/Lib/statistics.py
index 5be70e5ebf4e..79b65a29183c 100644
--- a/Lib/statistics.py
+++ b/Lib/statistics.py
@@ -603,7 +603,7 @@ def multimode(data):
 # options make for easier choices and that external packages can be
 # used for anything more advanced.
 
-def quantiles(dist, *, n=4, method='exclusive'):
+def quantiles(dist, /, *, n=4, method='exclusive'):
     '''Divide *dist* into *n* continuous intervals with equal probability.
 
     Returns a list of (n - 1) cut points separating the intervals.
diff --git a/Misc/NEWS.d/next/Library/2019-06-25-05-07-48.bpo-36546.RUcxaK.rst b/Misc/NEWS.d/next/Library/2019-06-25-05-07-48.bpo-36546.RUcxaK.rst
new file mode 100644
index 000000000000..f6829fb1727e
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-06-25-05-07-48.bpo-36546.RUcxaK.rst
@@ -0,0 +1,4 @@
+The *dist* argument for statistics.quantiles() is now positional only. The
+current name doesn't reflect that the argument can be either a dataset or a
+distribution.  Marking the parameter as positional avoids confusion and
+makes it possible to change the name later.



More information about the Python-checkins mailing list