[issue18844] allow weights in random.choice

Raymond Hettinger report at bugs.python.org
Sun Sep 1 23:17:48 CEST 2013


Raymond Hettinger added the comment:

> I like the idea about adding a family of distribution generators

Let's stay focused on the OP's feature request for a weighted version of choice().

For the most part, it's not a good idea to "just add" a family of anything to the standard library.  We wait for user requests and use cases to guide the design and error on the side of less, rather than more.  This helps avoid bloat.   Also, it would be a good idea to start something like this as a third-party to module to let it iterate and mature before deciding whether there was sufficient user uptake to warrant inclusion in the standard library.

For the current request, we should also do some research on existing solutions in other languages.  This isn't new territory.  What do R, SciPy, Fortran, Matlab or other statistical packages already do?  Their experiences can be used to inform our design.  Alan Kay's big criticism of Python developers is that they have a strong propensity invent from scratch rather than taking advantage of the mountain of work done by the developers who came before them.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18844>
_______________________________________


More information about the Python-bugs-list mailing list