[issue18297] In range.sample() correct the ValueError message for negative k

New submission from py.user:
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
---------- assignee: docs@python components: Documentation, Library (Lib) messages: 191832 nosy: docs@python, py.user priority: normal severity: normal status: open title: In range.sample() correct the ValueError message for negative k type: enhancement versions: Python 3.3, Python 3.4 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue18297> _______________________________________

Changes by py.user <bugzilla-mail-box@yandex.ru>: ---------- keywords: +patch Added file: http://bugs.python.org/file30697/issue18297.diff _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue18297> _______________________________________

Changes by Serhiy Storchaka <storchaka@gmail.com>: ---------- nosy: +mark.dickinson, rhettinger _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue18297> _______________________________________

Changes by Serhiy Storchaka <storchaka@gmail.com>: ---------- title: In range.sample() correct the ValueError message for negative k -> In random.sample() correct the ValueError message for negative k _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue18297> _______________________________________

Mark Dickinson added the comment: This has been proposed and rejected before: see issue #17388. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue18297> _______________________________________

Changes by Mark Dickinson <dickinsm@gmail.com>: ---------- resolution: -> duplicate status: open -> closed superseder: -> Providing invalid value to random.sample can result in incorrect error message _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue18297> _______________________________________

py.user added the comment: it was rejected by Raymond Hettinger because the proposed message wasn't informative ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue18297> _______________________________________
participants (3)
-
Mark Dickinson
-
py.user
-
Serhiy Storchaka