Optimization: Picking random keys from a dictionary and mutating values

Raymond Hettinger python at rcn.com
Thu May 29 02:45:33 EDT 2008


On May 28, 4:41 pm, blaine <frik... at gmail.com> wrote:
> 1.  Whats a good way to get the keys? I'm using a loop with
> random.choice() at the moment.

Why not keep a separate list of keys and use random.sample()?


Raymond



More information about the Python-list mailing list