This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xksteven
Recipients Christian.Kleineidam, NeilGirdhar, aisaac, dkorchem, madison.may, mark.dickinson, pitrou, rhettinger, serhiy.storchaka, tim.peters, westley.martinez, xksteven
Date 2016-03-30.18:48:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1459363694.77.0.930635042841.issue18844@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-03-30 18:48:14xkstevensetrecipients: + xksteven, tim.peters, rhettinger, mark.dickinson, pitrou, aisaac, westley.martinez, serhiy.storchaka, NeilGirdhar, madison.may, dkorchem, Christian.Kleineidam
2016-03-30 18:48:14xkstevensetmessageid: <1459363694.77.0.930635042841.issue18844@psf.upfronthosting.co.za>
2016-03-30 18:48:14xkstevenlinkissue18844 messages
2016-03-30 18:48:14xkstevencreate