[issue15265] random.sample() docs unclear on k < len(population)

2012-07-08 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks, I've added a note. -- resolution: -> fixed status: open -> closed ___ Python tracker ___ __

[issue15265] random.sample() docs unclear on k < len(population)

2012-07-08 Thread Roundup Robot
Roundup Robot added the comment: New changeset 72174d8af3ba by Raymond Hettinger in branch 'default': Issue 15265: document the exception raised for invalid sample sizes. http://hg.python.org/cpython/rev/72174d8af3ba -- nosy: +python-dev ___ Python t

[issue15265] random.sample() docs unclear on k < len(population)

2012-07-07 Thread Eugenio Minardi
Eugenio Minardi added the comment: Ok, I have updated the patch -- Added file: http://bugs.python.org/file26296/issue15265-fix-docs-update.patch ___ Python tracker ___ _

[issue15265] random.sample() docs unclear on k < len(population)

2012-07-07 Thread Roy Smith
Roy Smith added the comment: The docs describe population as a "sequence". Your patch describes it as a "list". I would go with: If *len(population)* is less than *k*, raises :exc:`ValueError`. -- ___ Python tracker

[issue15265] random.sample() docs unclear on k < len(population)

2012-07-07 Thread Eugenio Minardi
Eugenio Minardi added the comment: Added the related line to the documentation describing when the exception is raised. -- keywords: +patch nosy: +kmox83 Added file: http://bugs.python.org/file26285/issue15265-fix-docs.patch ___ Python tracker

[issue15265] random.sample() docs unclear on k < len(population)

2012-07-06 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: docs@python -> rhettinger priority: normal -> low ___ Python tracker ___ ___ Python-bugs-l

[issue15265] random.sample() docs unclear on k < len(population)

2012-07-06 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue15265] random.sample() docs unclear on k < len(population)

2012-07-06 Thread Roy Smith
New submission from Roy Smith : The docs don't say what happens if you call random.sample() with a population smaller than k. Experimentally, it raises ValueError, but this should be documented. I would have guessed it would return IndexError, by analogy to random.choice(). -- assign