On Fri, 18 Jan 2013 20:15:26 -0800, Chris Rebert wrote: > On Friday, January 18, 2013, Steven D'Aprano wrote: > >> I wish to add a key to a dict only if it doesn't already exist, but do >> it in a thread-safe manner. [...] > I'm not entirely sure, but have you investigated dict.setdefault() ?
Great! That's exactly what I need, thanks to everyone who responded. -- Steven -- http://mail.python.org/mailman/listinfo/python-list