Aristide Grange added the comment:
My bad... For my reference to Python 2, I relied on my memory only, which
starts to vanish. Really sorry about that. Yes, `random.choice(d)` (mostly)
fails in Python 2 too, with an error message that I better understand after
reading your explanation.
So, i
Tim Peters added the comment:
This won't be changed. The dict type doesn't support efficient random choice
(neither do sets, by the way), and it's been repeatedly decided that it would
do a disservice to users to hide that. As you know, you can materialize the
keys in a list (or tuple) firs
New submission from Aristide Grange :
In Python 3, the expression:
```python
random.choice(d)
```
where `d` is a `dict`, raises this error:
```
~/anaconda3/lib/python3.6/random.py in choice(self, seq)
256 except ValueError:
257 raise IndexError('Cannot choose from a