New submission from Leo <dontsendleos...@gmail.com>: The following code should just work:
import random random.choice(set(range(5))) instead the output is TypeError: TypeError: 'set' object does not support indexing The algorithm in random.choice requires a sequence, but the semantics of choice do not, and should not, require a sequence. The code should be changed to convert the input to a sequence instead. Cheers, Leo. ---------- components: Library (Lib) messages: 96480 nosy: lleeoo severity: normal status: open title: random.choice should accept a set as input type: behavior versions: Python 2.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7522> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com