[issue22048] Add weighted random choice to random package

2014-07-23 Thread Dmitry Korchemny
New submission from Dmitry Korchemny: Need to have a function for weighted randomization: given a dictionary: key -> weight (= non-negative number), return a key of the dictionary with the probability proportional to its weight. This capability is basic and is badly miss

[issue21706] Add base for enumerations (Functional API)

2014-06-10 Thread Dmitry Korchemny
Dmitry Korchemny added the comment: I think that the situation when you want start numbering from 0 is rather common, especially when you need to define bit fields as enumeration or when you need to implement an interface with other languages (e.g., C

[issue21706] Add base for enumerations (Functional API)

2014-06-10 Thread Dmitry Korchemny
New submission from Dmitry Korchemny: In enum module the functional API for enum creation has the following signature: Enum(value='NewEnumName', names=<...>, *, module='...', qualname='...', type=) so that the numeration always starts with 1. In some cases