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

Roy Smith report at bugs.python.org
Fri Jul 6 19:50:45 CEST 2012


New submission from Roy Smith <roy at panix.com>:

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().

----------
assignee: docs at python
components: Documentation
messages: 164742
nosy: docs at python, roysmith
priority: normal
severity: normal
status: open
title: random.sample() docs unclear on k < len(population)
type: enhancement

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15265>
_______________________________________


More information about the docs mailing list