Message262678
Hey serhiy.storchaka
I can edit the code to output just one value if called with simply a list and then return a list of values if called with the optional amount parameter. My code also needs to check that amount >= 1.
My code was mostly just to restart this discussion as I personally like the idea of the function for weighted choice and would like it to be standard in the random library.
I have no qualms with adding both weighted_choice and weighted_choice_generator but my concern is mostly that you are asking too much and it won't go through by trying to add two functions at the same time. The other thing is that I believe that weighted_choice could suffice with just one function call.
I just think my last concern is that generators are different from the other functions in random.py. Whereas they are more intuitive and accepted in the builtins like map and zip etc. There isn't any other functions in the random library that return that type of object when called. They instead return a numerical result.
Those are my concerns and hence why I rewrote the code. |
|
Date |
User |
Action |
Args |
2016-03-30 18:48:14 | xksteven | set | recipients:
+ xksteven, tim.peters, rhettinger, mark.dickinson, pitrou, aisaac, westley.martinez, serhiy.storchaka, NeilGirdhar, madison.may, dkorchem, Christian.Kleineidam |
2016-03-30 18:48:14 | xksteven | set | messageid: <1459363694.77.0.930635042841.issue18844@psf.upfronthosting.co.za> |
2016-03-30 18:48:14 | xksteven | link | issue18844 messages |
2016-03-30 18:48:14 | xksteven | create | |
|