Can dicts be threadsafe?

Basic data structures are not and probably never will be threadsafe—it introduces way too much overhead when you don’t need thread safety. If you want to safely share a dict between threads, you can use a lock, or better still, take a page out of Go’s playbook and have a single task which manages the dict and let other tasks send it messages to tell it to update the dict instead.

21 Likes