diff options
author | Raymond Hettinger <python@rcn.com> | 2004-06-05 14:53:22 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2004-06-05 14:53:22 (GMT) |
commit | 9021c955951c63ef3075b4751615af329427d3ec (patch) | |
tree | cbce18feb4a45176884aa7114231fec740869cbe | |
parent | ba8b6bc86fcb00b37a53f8edd8f38c4b0e77f3a5 (diff) | |
download | cpython-9021c955951c63ef3075b4751615af329427d3ec.zip cpython-9021c955951c63ef3075b4751615af329427d3ec.tar.gz cpython-9021c955951c63ef3075b4751615af329427d3ec.tar.bz2 |
SF bug #964230: random.choice([]) should return more intelligible exception
Add a comment to make the traceback less mysterious.
-rw-r--r-- | Lib/random.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/random.py b/Lib/random.py index 58865fc..92163bb 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -237,7 +237,7 @@ class Random(_random.Random): def choice(self, seq): """Choose a random element from a non-empty sequence.""" - return seq[int(self.random() * len(seq))] + return seq[int(self.random() * len(seq))] # raises IndexError in seq is empty def shuffle(self, x, random=None, int=int): """x, random=random.random -> shuffle list x in place; return None. |