Is `wsample` a proper name for a function like this?
Satoru Logic
satorulogic at gmail.com
Wed Oct 10 23:33:16 EDT 2012
I came across a function named `wsample` in a `utils` package of my workplace recently.
The "w" in `wsample` stands for `weighted`, and it randomly selects an element from a container according to relative weights of all the elements.
In most articles and codes I saw online, a function like this is often named `weighted_random_choice`, which sounds *correct* to me.
So when I saw this `wsample` function, I considered it a improper name.
Because `wsample`makes me think of `random.sample`, which returns a list of randomly generated elements, not a element.
More information about the Python-list
mailing list