Popular recipes by Carlos Valiente http://code.activestate.com/recipes/users/4174637/2010-08-19T08:40:38-07:00ActiveState Code RecipesWeighted random choice (Python) 2010-08-19T08:40:38-07:00Carlos Valientehttp://code.activestate.com/recipes/users/4174637/http://code.activestate.com/recipes/577363-weighted-random-choice/ <p style="color: grey"> Python recipe 577363 by <a href="/recipes/users/4174637/">Carlos Valiente</a> (<a href="/recipes/tags/random/">random</a>, <a href="/recipes/tags/sequence/">sequence</a>). </p> <p>This function returns a random element from a sequence. The probability for each element in the sequence to be selected can be weighted by a user-provided callable</p> Starting several context managers concurrently (Python) 2010-08-11T14:27:01-07:00Carlos Valientehttp://code.activestate.com/recipes/users/4174637/http://code.activestate.com/recipes/577352-starting-several-context-managers-concurrently/ <p style="color: grey"> Python recipe 577352 by <a href="/recipes/users/4174637/">Carlos Valiente</a> . </p> <p>This recipe implements the <code>parallel</code> context manager, which executes the <code>__enter__</code> and <code>__exit__</code> method of its arguments concurrently.</p>