Steven Basart added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18844>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to