This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: In random.sample() correct the ValueError message for negative k
Type: enhancement Stage:
Components: Documentation, Library (Lib) Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Providing invalid value to random.sample can result in incorrect error message
View: 17388
Assigned To: docs@python Nosy List: docs@python, mark.dickinson, py.user, rhettinger
Priority: normal Keywords: patch

Created on 2013-06-25 05:03 by py.user, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue18297.diff py.user, 2013-06-25 05:04 review
Messages (3)
msg191832 - (view) Author: py.user (py.user) * Date: 2013-06-25 05:03
>>> random.sample('ABC', -1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.3/random.py", line 302, in sample
    raise ValueError("Sample larger than population")
ValueError: Sample larger than population
>>>
msg191837 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2013-06-25 08:22
This has been proposed and rejected before:  see issue #17388.
msg191869 - (view) Author: py.user (py.user) * Date: 2013-06-25 17:08
it was rejected by Raymond Hettinger because the proposed message wasn't informative
History
Date User Action Args
2022-04-11 14:57:47adminsetgithub: 62497
2013-06-25 17:08:36py.usersetmessages: + msg191869
2013-06-25 11:14:14mark.dickinsonsetstatus: open -> closed
superseder: Providing invalid value to random.sample can result in incorrect error message
resolution: duplicate
2013-06-25 08:22:56mark.dickinsonsetmessages: + msg191837
2013-06-25 07:35:40serhiy.storchakasettitle: In range.sample() correct the ValueError message for negative k -> In random.sample() correct the ValueError message for negative k
2013-06-25 07:30:37serhiy.storchakasetnosy: + rhettinger, mark.dickinson
2013-06-25 05:04:19py.usersetfiles: + issue18297.diff
keywords: + patch
2013-06-25 05:03:53py.usercreate