[issue12941] add random.pop()

Mark Dickinson report at bugs.python.org
Fri Sep 9 14:04:55 CEST 2011


Mark Dickinson <dickinsm at gmail.com> added the comment:

> is it really worth adding?

Probably not.  For improvements along these lines, I'd rather see random.choice support sets:

>>> random.choice({1, 2})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/random.py", line 274, in choice
    return seq[int(self.random() * len(seq))]  # raises IndexError if seq is empty
TypeError: 'set' object does not support indexing

But that's another (rejected) issue; see issue 7522.

----------
nosy: +mark.dickinson

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


More information about the Python-bugs-list mailing list