[Python-Dev] non-mutating 'choose' to go with 'dict.popitem'? (original) (raw)

Greg Wilson Greg.Wilson@baltimore.com
Sun, 6 May 2001 12:26:00 -0400


Has anyone else found themselves wanting a method that chooses and returns a dictionary element at random, without removing it (as popitem does)? Or is there some way to tell popitem to return a value without mutating the container? If neither, would this be useful, or is it DHG?

Thanks Greg