Hi, I just learned how to use random.choices(). I initially misunderstood the documentation for cum_weights as meaning that a cumulative sequence would be *constructed from* the sequence which I supplied. Consequently, I specified 'cum_weights' with a sequence which wasn't in ascending order. I got back k results but I determined that they weren't correct (eg, certain population values were never returned).
Since the non-ascending sequence, which I had supplied, could not possibly be valid input, why isn't this checked (and an error returned)? Returning incorrect results (which could be hard to spot as being incorrect) is much more dangerous. Also, checking that the list is in ascending order need only be done once, and seems like it would be inexpensive. Thanks, Paul -- https://mail.python.org/mailman/listinfo/python-list