Raymond Hettinger added the comment: The sticking point is going to be that we don't want to recompute the cumulative weights for every call to weighted_choice.
So there should probably be two functions: cw = make_cumulate_weights(weight_list) x = choice(choice_list, cw) This is similar to what was done with string.maketrans() and str.translate(). ---------- _______________________________________ Python tracker <[email protected]> <http://bugs.python.org/issue18844> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
