Is defaultdict thread safe?

Frank Millman frank at
Mon Jan 25 09:59:01 CET 2010

Hi all

Is defaultdict thread safe?

Assume I have -

    from collections import defaultdict
    my_dict = defaultdict(list)

If two threads call "my_dict['abc'].append(...)" simultaneously, is it 
guaranteed that my_dict['abc'] will end up containing two elements?


Frank Millman

More information about the Python-list mailing list