[issue43097] IndexError msg of random.choice() not helpful

2021-02-04 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> wont fix stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Pyth

[issue43097] IndexError msg of random.choice() not helpful

2021-02-02 Thread Raymond Hettinger
Raymond Hettinger added the comment: -1 on changing this because we would have to gum-up and slow down the code with an extra try-except to catch and reraise the exception with a different error message: def choice(self, seq): """Choose a random element from a non-empty sequence.

[issue43097] IndexError msg of random.choice() not helpful

2021-02-02 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue43097] IndexError msg of random.choice() not helpful

2021-02-01 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +mark.dickinson, rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue43097] IndexError msg of random.choice() not helpful

2021-02-01 Thread wyz23x2
New submission from wyz23x2 : When you apply `random.choice` on empty sequences: >>> import random >>> random.choice([]) Traceback (most recent call last): File "", line 2, in return seq[self._randbelow(len(seq))] IndexError: list index out of range This message doesn't clearly state the